Reputation: 1606
Hello i have a very old and BIG query which gous like this:
select id, someValue, (select x from y inner join x on x.y = y.zzz) as filter
Now i need to filter for the deliverd variable like
select id, someValue, (select x from y inner join x on x.y = y.zzz) as filter
WHERE filter not 'badPractise'
Is there any way i can use it without making the same join in the where clausule?
Upvotes: 1
Views: 416
Reputation: 64466
Yes you can use HAVING
clause to filter out with your filter column
select id, someValue,
(select x from y inner join x on x.y = y.zzz) as filter
FROM ....
HAVING filter <> 'badPractise'
Upvotes: 1