Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with select and case stamenet 1

Status
Not open for further replies.

morfasie

IS-IT--Management
Mar 28, 2004
85
ZA
I have this statement :
SELECT sum(CASE WHEN `Agent Code` LIKE '%GB01%' THEN Premium END ) AS 'Tswane Soweto',
sum(CASE WHEN `Agent Code` LIKE '%WW02%' THEN Premium END ) AS 'North West Moretele',
sum(CASE WHEN `Agent Code` LIKE '%WW02%' THEN Premium END ) AS 'North West Odi',
sum(CASE WHEN `Agent Code` LIKE '%GA01%' THEN Premium END ) AS 'Tswane PTA'
FROM production

but I want to put a where in ('PTA','JHB') intot every case statement. Where do I put it with the above?

thanks
 
Why not just add a WHERE clause after the FROM one ?

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
Take a look at the IIf function.

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top