sql - CASE WHEN THEN ELSE change to union? -


i wondering if possible change case when else union all, or this.

i hope possible ...

example

case when(c.salutation = 'dhr.' or c.salutation = 'dhr.')          'meneer'+' '+isnull(c.middlename+' ','')+c.lastname     when(c.salutation = 'mw.' or c.salutation = 'mw.')          'mevrouw'+' '+isnull(c.middlename+' ','')+c.lastname     else 'meneer/mevrouw '+isnull(c.middlename+' ','')+isnull(c.lastname,'') end 'k5' 

i hope guys can me out..

well, yes can, ugly:

select 'meneer'+' '+isnull(c1.middlename+' ','')+c1.lastname 'k5' table c1 c1.salutation = 'dhr.' or c1.salutation = 'dhr.' union select 'mevrouw'+' '+isnull(c2.middlename+' ','')+c2.lastname table c2 c2.salutation = 'mw.' or c2.salutation = 'mw.' union select 'meneer/mevrouw '+isnull(c.middlename+' ','')+isnull(c.lastname,'') table c3 c3.salutation != 'mw.' , c3.salutation != 'mw.' , c3.salutation != 'dhr.' , c3.salutation != 'dhr.' 

Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -