Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
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.
SUM(CASE WHEN Department = 'SOUH' THEN TrxFullPrice ELSE 0 END) AS SOUH
i need to add multiple departments however i cannot get it to work.something like this.
SUM(CASE WHEN Department = 'SOUH', 'DIAM', 'JEWR' THEN TrxFullPrice ELSE 0 END) AS SOUH
can someone please let me know if this is possible?or provide a workaround?
nigelrivett
Master Smack Fu Yak Hacker
3385 Posts
Posted - 2011-01-05 : 20:05:16
SUM(CASE WHEN Department in ('SOUH', 'DIAM', 'JEWR') THEN TrxFullPrice ELSE 0 END) AS SOUH==========================================Cursors are useful if you don't know sql.SSIS can be used in a similar way.Beer is not cold and it isn't fizzy.
direrayne
Starting Member
30 Posts
Posted - 2011-01-05 : 21:03:04
quote:Originally posted by nigelrivett SUM(CASE WHEN Department in ('SOUH', 'DIAM', 'JEWR') THEN TrxFullPrice ELSE 0 END) AS SOUH==========================================Cursors are useful if you don't know sql.SSIS can be used in a similar way.Beer is not cold and it isn't fizzy.