lundi 23 mars 2015

Nested IF statement in SQL

I am trying to recreate the following nested IF statement that I am using in excel within a SQL query:


=IF(AE20="",0,IF(AH20="",IF(AG20="",IF(AF20="",IF(AE20="","",AE20),AF20),AG20),AH20))


I did some research, and it appears that I need to use CASE, but in the examples I've found I'm still not able to connect the dots on the proper syntax to use given the example above.


I assumed it would start as


Select Case When ex_table.AE = ""


and I'm not sure where to go from there. I appreciate your help!


Aucun commentaire:

Enregistrer un commentaire