sqlselectfirebird

Query SELECT calculated column with condition


How do I create a calculated column in my SELECT QUERY where it has a condition?

Something like:

SELECT NAME, ADDRESS, IF TABLE.COD=101 THEN return TABLE.VALUE AS TABLE  
FROM CRM

The third argument in the SELECT is my calculated column with a condition.


Solution

  • SELECT NAME, ADDRESS, (Case WHEN TABLE.COD=101 THEN TABLE.VALUE END) AS TABLE  
    FROM CRM