Incorporating compound IF THEN ELSE ELSE statements using query builder functions?

by Aug 2, 2022

Haven’t tried this before, but I’m trying to idiot proof a set of query’s and make the held values understandable by the end user while utilizing the Aqua Data Studio – Query Builder.  As such I’m looking to incorporate a compound “IF THEN ELSE ELSE” statements to convert a numerical output to a string value in the results.

ex: IF [loi.status] = ‘2’ THEN “Submitted” ELSE IF [loi.status] = ‘1’ THEN “Waiting Approval” ELSE “Not Submitted”

I’m not sure of the syntax for this in Aqua Query Builder or if that’s even possible using the “Function” option of the “Select” statement value.  Yes I could try and utilize straight SQL write-up I guess… just thinking the GUI of the Builder makes it easier for anyone not familiar with SQL to understand/edit simple query limits for the overall query.

No joy with the above syntax or IIF statement (seen both as appropriate options in Aqua according to a couple sites).

Any help/advice would be appreciated.


Thomas Conrad 2 months ago


In Query Builder, you can select the down arrow in the Select deck. Select “Create Query Expression…” Here you can add expressions like if, then else. Here is an example using DB2 LUW:

Here is some documentation to check out…

Select Deck | Documentation 22.2 | Aqua Data Studio (