https://www.postgresql.org/docs/9.6/static/functions-conditional.html SELECT * FROM test; a --- 1 2 3 SELECT a, CASE WHEN a=1 THEN 'one' WHEN a=2 THEN 'two' ELSE 'other' END FROM test; a | case ---+------- 1 | one 2 | two 3 | other SELECT a, CASE a WHEN 1 THEN 'one' WHEN 2 THEN 'two' ELSE 'other' END FROM test; a | case ---+------- 1 | one 2 | two 3 | other SELECT SUBSTR("Accounting"."ChartOfAccounts".Account, 7, 3) as "Act", CASE SUBSTR("Accounting"."ChartOfAccounts".Account, 9, 1) WHEN '0' THEN 'cero' WHEN '1' THEN 'one' WHEN '2' THEN 'two' WHEN '3' THEN 'three' WHEN '4' THEN 'four' ELSE 'other' END AS "Ending" FROM "ChartOfAccounts" LIMIT 20;