Postgresql – SQL Execution Order for CASE WHEN & GROUP BY
The execution order in SQL is the following: FROM --> WHERE --> GROUP BY --> HAVING --> SELECT --> ORDER BY --> LIMIT In my query I am using a CASE WHEN statement and an aggregate function in the SELECT…