Sunday 15 August 2010

sql server 2012 - Including a conditional sql where statement -



sql server 2012 - Including a conditional sql where statement -

i'm trying include conditional statement in sql code , i'm not sure how it... looks (see below) although i'm i'm going wrong direction here.

[awb_prefix] in ('403','369') , [agent_iata_code] not in ('0508634') , [yr] = 2014 , case when [awb_prefix] = '369' [origin_gw_carrier] in ('po','9s','k4') else [origin_gw_carrier] in ('po','9s','k4','5y') end

that isn't case for. can seek doing this:

where [awb_prefix] in ('403','369') , [agent_iata_code] not in ('0508634') , [yr] = 2014 , ( ([awb_prefix] = '369' , [origin_gw_carrier] in ('po','9s','k4')) or ([awb_prefix] <> '369' , [origin_gw_carrier] in ('po','9s','k4','5y')) )

sql sql-server-2012 where where-in

No comments:

Post a Comment