Hello,
I have a sql statment and I am using case when, this is working well, but I would like to add if field1='abc then filed2=3 and field3=3*fieldqty
here is what I have so far
if i take this part out the code works well, not sure why this is not working
any help is much appreciated!!! thanks!!!
I have a sql statment and I am using case when, this is working well, but I would like to add if field1='abc then filed2=3 and field3=3*fieldqty
here is what I have so far
Code:
SELECT
WEBQRY.SHPORD.FECHNB,
WEBQRY.SHPORD.FEKNNB,
WEBQRY.SHPORD.FEAAC3,
WEBQRY.SHPORD.FECVNB,
WEBQRY.SHPORD.FECBTX,
WEBQRY.SHPORD.FEAAC9,
WEBQRY.SHPORD.DDAITX,
WEBQRY.SHPORD.BIHJTX,
WEBQRY.SHPORD.DDARQT,
WEBQRY.SHPORD.DDAAGP,
WEBQRY.SHPORD.EXT_PRICE,
right(FEALDT, 6) AS Create_Date,
right(DDAIDT, 6) AS Promised_Date,
right(DHIVNB, 6) AS Shipment_Date,
DAVIESF.COMXCPT.ITNBR,
(case when WEBQRY.SHPORD.DDAITX ='7303' then WEBQRY.SHPORD.DDAAGP=3 and WEBQRY.SHPORD.EXT_PRICE=3*WEBQRY.SHPORD.DDARQT when WEBQRY.SHPORD.DDAITX = DAVIESF.COMXCPT.ITNBR then 1 when WEBQRY.SHPORD.DDAITX Between 'SW3000%' and 'SW3020%' then 1 else 0 end) AS same
FROM WEBQRY.SHPORD
LEFT OUTER JOIN DAVIESF.COMXCPT ON WEBQRY.SHPORD.FECHNB = DAVIESF.COMXCPT.SLSNO AND WEBQRY.SHPORD.DDAITX = DAVIESF.COMXCPT.ITNBR AND WEBQRY.SHPORD.FEKNNB = DAVIESF.COMXCPT.CUSNO
WHERE ((case when WEBQRY.SHPORD.DDAITX ='7303' then WEBQRY.SHPORD.DDAAGP=3 and WEBQRY.SHPORD.EXT_PRICE=3*WEBQRY.SHPORD.DDARQT when WEBQRY.SHPORD.DDAITX = DAVIESF.COMXCPT.ITNBR then 1 when WEBQRY.SHPORD.DDAITX Between 'SW3000%' and 'SW3020%' then 1 else 0 end) =0)
if i take this part out the code works well, not sure why this is not working
Code:
when WEBQRY.SHPORD.DDAITX ='7303' then WEBQRY.SHPORD.DDAAGP=3 and WEBQRY.SHPORD.EXT_PRICE=3*WEBQRY.SHPORD.DDARQT
any help is much appreciated!!! thanks!!!