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.AccountNum ber) Like 'T%' THEN 'Toronto'
when (Select AccountCode from Clients where Clients.AccountNumber = finalizedorders.AccountNum ber) Like 'O%' THEN 'Ottawa'
when (Select AccountCode from Clients where Clients.AccountNumber = finalizedorders.AccountNum ber) Like 'B%' THEN 'Ottawa'
when (Select AccountCode from Clients where Clients.AccountNumber = finalizedorders.AccountNum ber) Like 'H%' THEN 'Halifax'
when (Select AccountCode from Clients where Clients.AccountNumber = finalizedorders.AccountNum ber) Like 'K%' THEN 'Waterloo'
when (Select AccountCode from Clients where Clients.AccountNumber = finalizedorders.AccountNum ber) 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.
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.AccountNum
when (Select AccountCode from Clients where Clients.AccountNumber = finalizedorders.AccountNum
when (Select AccountCode from Clients where Clients.AccountNumber = finalizedorders.AccountNum
when (Select AccountCode from Clients where Clients.AccountNumber = finalizedorders.AccountNum
when (Select AccountCode from Clients where Clients.AccountNumber = finalizedorders.AccountNum
when (Select AccountCode from Clients where Clients.AccountNumber = finalizedorders.AccountNum
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks