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 |
|
Vack
Aged Yak Warrior
530 Posts |
Posted - 2011-02-28 : 15:48:07
|
I have the following code. SELECT ord_no,count(case when prod_cat = '511' or prod_cat = '512' then ord_no end) as Rollerfrom oeordlin_sqlgroup by ord_no How do I have it count the prod_Cat for every other one without typing all of them in? Can I throw in something like this? Else as Spray |
|
|
sunitabeck
Master Smack Fu Yak Hacker
5155 Posts |
Posted - 2011-02-28 : 20:27:26
|
| [code]SELECT ord_no,count(case when prod_cat = '511' or prod_cat = '512' then ord_no end) as Roller,count(case when prod_cat <> '511' and prod_cat <> '512' then ord_no end) as Sprayfrom oeordlin_sqlgroup by ord_no[/code] |
 |
|
|
|
|
|