I am looking to do something like:
SELECT
Field1
, COUNT( IF( Field1 = 1, Field1, NULL ) ) AS one
, SUM( IF( Field1 = 2, Field1, NULL ) ) AS two
FROM
Table
GROUP BY
Field1
I tried it from the psql prompt and didn't work. Is there an IF or
IIF function that can be used on a select query?