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 |
|
RSRS
Starting Member
2 Posts |
Posted - 2004-02-24 : 09:02:36
|
I have a large table of sales detail e.g.:Cust1 | 22-dec | 99.95Cust2 | 23-dec | 2.99Cust2 | 23-dec | 140.00Cust2 | 23-dec | 100.00....and I want to output a report table grouped by cust/date such as:CustName | Date | TotalSales | Sales<10 | Sales<100 | OtherSalesCust1 | 22-d | 99.95 | 0 | 99.95 | 0Cust2 | 23-d | 242.99 | 2.99 | 240.00 | 0...Obviously this can be done by joining multiple queries, but is there a single query way around this?TIA for any help.  |
|
|
AndrewMurphy
Master Smack Fu Yak Hacker
2916 Posts |
Posted - 2004-02-24 : 09:04:42
|
| Investigate the CASE statement....search here for examples (use CASE + SUM as keywords)...there are some good recent simple examples that will get you moving in the right direction. |
 |
|
|
X002548
Not Just a Number
15586 Posts |
Posted - 2004-02-24 : 09:10:17
|
| Isn'tSales<100 Really10>Sales<100Brett8-) |
 |
|
|
RSRS
Starting Member
2 Posts |
Posted - 2004-02-24 : 09:41:45
|
| Sorted now. Thanks for the pointer! |
 |
|
|
|
|
|