I'm trying to compute the difference between two columns, and then filter the results within a WHERE command.
Like this:
SELECT abs("c1" - "c2") as diff
FROM table1
WHERE diff < 3
I get a "ERROR: column "diff" does not exist".
How should I set it up so I can reuse the newly created column "diff" to filter the results?