Link to home
Start Free TrialLog in
Avatar of W.E.B
W.E.B

asked on

SQL Select count

Hello,
Can you please help,
I need to get the Operator count per city.
this is my Select Statment,

Select case when Operator like 'WEB' THEN 'WEB' ELSE 'CSR' END AS [Oprator],
case when (Select AccountCode from Clients where Clients.AccountNumber = finalizedorders.AccountNumber) Like 'T%' THEN 'Toronto'
when (Select AccountCode from Clients where Clients.AccountNumber = finalizedorders.AccountNumber) Like 'O%' THEN 'Ottawa'
when (Select AccountCode from Clients where Clients.AccountNumber = finalizedorders.AccountNumber) Like 'B%' THEN 'Ottawa'
when (Select AccountCode from Clients where Clients.AccountNumber = finalizedorders.AccountNumber) Like 'H%' THEN 'Halifax'
when (Select AccountCode from Clients where Clients.AccountNumber = finalizedorders.AccountNumber) Like 'K%' THEN 'Waterloo'
when (Select AccountCode from Clients where Clients.AccountNumber = finalizedorders.AccountNumber) Like 'V%' THEN 'Vancouver'
Else 'Montreal' END as [City]
FROM finalizedorders WHERE ((OrderDate >= '2014-01-01')) and AccountNumber not in (3333,3334,3335)
Order by City,Operator


Thanks for your help.
ASKER CERTIFIED SOLUTION
Avatar of Shaun Kline
Shaun Kline
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of W.E.B
W.E.B

ASKER

Excellent,
Thanks