samedi 7 mars 2015

Multiple returns for then in case used in select of SQL

I need a sql replacement for the code below


if(a in (1,2,3,4)) then 'yes' as "X required?" and column -- column here is a column from the table else 'no'


if(a in (5,6,7,8)) then 'yes' as "Y required?" and column else 'no' end


here I am trying to find out if X,Y are required depending on the values of a. If required, fetching the details related to that particular a in the same row. output can be like this



X required? column Y required? column
yes ijk no null
yes ppp yes qqq


can you please help me out in this.


Aucun commentaire:

Enregistrer un commentaire