jeudi 7 mai 2020

If Else in MSSQL

I am selecting multiple columns from a table.eg.type,orno,dsca,etc.

I want to display 'dsca' value depending upon the value of 'type'. If 'type' = 9 or 10 then dsca = 'something' else dsca is from table

   select orno,dsca,type from ttxdes102
   where type in (1, 4,9,10)
   and IF (type = 9 or type = 10) then dsca = 'NOT Available' END

Aucun commentaire:

Enregistrer un commentaire