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 |
|
raisor
Starting Member
28 Posts |
Posted - 2004-11-24 : 08:28:59
|
| Hello everyone,I have a 'priceOriginal' field that is float, it has prices stored such as 51.99 etc. etc.Now I need to create a 10% discount of it all to another float field called price.I'm trying to accomplish this by doing:UPDATE productsSET price = ROUND(priceOriginal - priceOriginal * .1, 0)It works, but I receive results such as:priceOriginal: 45.99And then the price becomesprice: 41Even though I want it to become: 41.39 (rounded 41.391 to two digits after the dot)How can I accomplish this?Thank you very much! |
|
|
AndrewMurphy
Master Smack Fu Yak Hacker
2916 Posts |
Posted - 2004-11-24 : 08:39:32
|
| UPDATE productsSET price = ROUND(priceOriginal - (priceOriginal * .1), 2) |
 |
|
|
raisor
Starting Member
28 Posts |
Posted - 2004-11-24 : 08:46:40
|
| ehm......'Silence'I was close though ;)Geeeez, that was stupid!, well thank you very much! :D |
 |
|
|
jen
Master Smack Fu Yak Hacker
4110 Posts |
Posted - 2004-11-25 : 02:40:08
|
| or you couldUPDATE productsSET price = ROUND(priceOriginal * .9, 2)--------------------keeping it simple... |
 |
|
|
|
|
|