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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 A math comparison

Author  Topic 

sqlbug
Posting Yak Master

201 Posts

Posted - 2009-11-05 : 18:05:37
Hello,

I need to compare two column values (decimal) in my where clause like:

Round(col1 * 10(to the power col3)) > Round(col2 * 10(to the power col3))

Thanks for help.

Sqlbug

jimf
Master Smack Fu Yak Hacker

2875 Posts

Posted - 2009-11-05 : 18:20:14
There's no need to multiply anything, you just have to round to the appropriate place

WHERE round(col1,3) > round(col2,3)

or whatever precision you need

Jim

Everyday I learn something that somebody else already knew
Go to Top of Page

sqlbug
Posting Yak Master

201 Posts

Posted - 2009-11-05 : 18:35:43
Thanks Jim...I looked at the ROUND function and found what you said.
Go to Top of Page
   

- Advertisement -