Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
jackmac
Starting Member
2 Posts |
Posted - 2005-09-30 : 05:35:52
|
| Hi all,Hopefully a nice easy one to begin with. I have an access database which I use to build my web pages - I use sql to extract products which meet certain criteria then the pages are automatically generated. I can extract the data without any problem. An example I use is shown below:===================================================SELECT * FROM products WHERE products.group = 'LCD-HDTV' AND status = 'LIVE' AND tradeprice > 0 AND description3 > '' ORDER BY diagonal, tradeprice, description3===================================================I now want to get it to work out a discount of 1% on the products shown using the tradeprice field. I've tried many times using the SELECT and SUM functions but am not getting the syntax correct. Any help would be very much appreciated.TIAJackmac |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2005-09-30 : 05:47:00
|
is this sql server sqlor access sql?because there is an access forum here that will get you faster help if it's accessbut it's something like:iif(your condition for discount, tradeprice*0.99, tradeprice)Go with the flow & have fun! Else fight the flow |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-09-30 : 05:47:43
|
| If the tradeprice is 100 then do you want to show it as 99?If so use thisSelect OtherColumns, tradeprice-(tradeprice*0.01) from products WHERE products.group = 'LCD-HDTV' AND status = 'LIVE' AND tradeprice > 0 AND description3 > '' ORDER BY diagonal, tradeprice, description3MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|