[QODBC-Desktop] How to use Case When statement query in QODBC
Posted by Rajendra Dewani (QODBC Support) on 14 April 2014 03:58 PM
How can I use Case When statement query in QODBC
You can use Case When statement query in QODBC as below:
In SELECT Statement, Simple CASE Statement is only used to check whether the value is equal.
Below is an example:
SELECT ListID,Active = CASE IsActive WHEN 1 THEN 'Active' WHEN 0 THEN 'NotActive' ELSE 'UNKnown' END FROM Vendor
An example of Case When with IN Statement:
You can use IN Statement in Case When as below.
SELECT ListID, Balance, CASE WHEN Balance IN (11026.45 ,57938.60) THEN 'HIGH' WHEN Balance IN (2770.50 ,7125.50) THEN 'MED' WHEN Balance IN (0.45) THEN 'LOW' ELSE '--NA--' END FROM Vendor