Hello,
I'm having problem migrating to postgreSQL from MySQL, some of my queries does not work in postgres.
Query(simplifie d):
Error:
How to use a 'case column' in HAVING clause?
I'm having problem migrating to postgreSQL from MySQL, some of my queries does not work in postgres.
Query(simplifie d):
Code:
SELECT t1.bus_stop, t1.time, (case when t1.time >2200 then t1.time + 10000 else t1.time END) AS sort_column FROM routes AS t1 GROUP BY t1.bus_stop, t1.time HAVING sort_column > 2200 ORDER BY sort_column LIMIT 1
Code:
ERROR: column "sort_column" does not exist
Comment