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 |
|
zwheeler
Starting Member
25 Posts |
Posted - 2011-09-28 : 11:12:27
|
| HiI am using the round function in my select statement and it works for the following Round(avg(h.mtr_fass_score)) as mtr_fass, <------THIS WORKS Round(avg(case when p.mtr_unit_count is null then null else f.mtr_5100t / ( p.mtr_unit_count * 12 ) end )) as mtr_grs_rent_unit, <--- this does not work What am i doing wrong in this case or is this possible |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-09-28 : 11:14:25
|
| it might be divide by zero error. tryRound(avg(case when p.mtr_unit_count is null then null else f.mtr_5100t / ( nullif(p.mtr_unit_count,0) * 12 ) end )) as mtr_grs_rent_unit------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
zwheeler
Starting Member
25 Posts |
Posted - 2011-09-28 : 11:37:19
|
| Thanks |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-09-28 : 11:48:57
|
| wc------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|