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 |
|
Kotti
Posting Yak Master
129 Posts |
Posted - 2008-11-07 : 08:09:23
|
| Hi friends,i am calculating average rating according to no of persons and the maximum rating will be 5.what i need is ,if i my avg rating is from 0.01 to 0.49 it must take the value as 0.50 and if it from 0.51 to 0.99 it must take the value as 1.00Like that for 1.01 to 1.49 as 1.50 and 1.51 to 1.99 as 2.00 This will be upto 5 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-11-07 : 08:24:15
|
[code]DECLARE @Sample TABLE ( value SMALLMONEY )INSERT @SampleSELECT 1.01 UNION ALLSELECT 1.49 UNION ALLSELECT 1.50 UNION ALLSELECT 1.51 UNION ALLSELECT 1.99 UNION ALLSELECT 2.00SELECT value, (100 * value + 50 - 100 * value % 50) / 100 AS PesoFROM @Sample[/code] E 12°55'05.63"N 56°04'39.26" |
 |
|
|
|
|
|