MySQL Forums
Forum List  »  Newbie

Re: JOIN, WHERE and calculated column (based on JOIN and WHERE)
Posted by: Peter Brawley
Date: June 29, 2018 05:36AM

> select count(distinct t2.num)
> from test t2
> where t2.num <= t.num

Cannot work because SQL parsers read the Where clause before they read the Select expressions. Use Having ...

select ...
from ...
group by ...
having ...

Options: ReplyQuote


Subject
Written By
Posted
Re: JOIN, WHERE and calculated column (based on JOIN and WHERE)
June 29, 2018 05:36AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.