If I have a query, such as:
select column1, (
select count(*) from table2
) as some_count
from table1
where column1 = 'foo'
I can use column1
in the where clause, but if I try to add
and some_count > 0
then I get an error that some_count
doesn't exist. How can I use that in a where clause?