mardi 19 novembre 2019

IF / Case statment in SQL

I have a column where I have 0 or 1. I like to do the following set up:

If 0 than put / use the Region_table (here I have regions like EMEA, AP,LA with finished goods only) and when it 1 then put / use the Plant_table (here I have plants with non-finished goods) data's.

enter image description here

I tried to write it in 2 different statements but it is not good:

,Case 

when [FG_NFG_Selektion]  = '0'  Then 'AC_region' 

End as 'AC_region' 

,Case

when [FG_NFG_Selektion]  = '1'  Then 'AC_plant'

End as 'AC_plant'

Aucun commentaire:

Enregistrer un commentaire