I'm transferring over some queries from MySQL to PostgreSQL and I'm stumped on how to rewrite the following query to work in PostgreSQL:
SUM(phoneid IN (1, 2, 6, 8)) AS completedcalls
I originally thought I could just do SUM(SELECT phoneid FROM myTable WHERE phoneid = 1 OR phoneid = 2
etc etc, but I do not believe you can have a SELECT within a sum.
I also tried using a WITH
query but had no luck getting that to work.