how can i put multiple statmwnts in sum(case...

From: Totti <>
Date: Sat, 5 Jan 2008 19:35:12 -0800 (PST)
Message-ID: <>

hi all, how ca put multiple statmwnts in sum(case statment? like if i have 4 regions, and 1 product, if for each region the transport fee is different, in a sum case how can that be done, is there any " nested if statment". i tried this and of course this is not the correct result:

SUM(CASE WHEN prod_1.category = 'Base' AND CUST_1.REGION = 'East' then(salpmt_1.amount*0.150 + salpmt_1.amount) else 0 end)AS"Base", SUM(CASE WHEN prod_1.category = 'Base' AND CUST_1.REGION = 'West' then(salpmt_1.amount*0.170 + salpmt_1.amount) else 0 end)AS"Base",

but this leads to 2 Base the one near the other, while what i need is :

if base and east = x, if base and west = y, if base and north = z ..... else 0 end.

how could that be done please? Received on Sat Jan 05 2008 - 21:35:12 CST

Original text of this message