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 |
|
Les.61
Starting Member
49 Posts |
Posted - 2009-11-05 : 23:09:54
|
| I am trying to create a report that will group by balance bands.The report would look like:Band Total< $5,000 $654,987.32< $20,000 $452,698.21<$100,000 $234,765.65>$100,000 $1,987,568.45The totals are for less then $5,000, between $5,000 and $20,000, between $20,000 and $100,000 and over $100,000Thanks |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2009-11-05 : 23:24:56
|
[code]select Band, sum(Total)from( select Band = case when balance <= 5000 then '< $5,000' when balance > 5000 and <= 20000 then '< $20,000' . . . end, Total from yourtable) agroup by Band[/code] KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
Les.61
Starting Member
49 Posts |
Posted - 2009-11-08 : 20:51:01
|
| I was not able to get the query to work however using the bulk of the response from KH I was able to create a view which worked perfectly.Many Thanks to KH for their assistance |
 |
|
|
|
|
|
|
|