-
Notifications
You must be signed in to change notification settings - Fork 590
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable having clause to refer to an alias #7506
Comments
Just found sqlite & duckdb also supports it.
But I still don't think it's worth diverging from Postgres. It's a road of no return. 🤪 |
SELECT YEAR(orderdate), COUNT(*) as Amount
FROM Sales.Orders
GROUP BY YEAR(orderdate)
HAVING Amount > 1; Quick example, just in case I am not the only SQL noob out there 😁 |
Just feel that the ultimate goal is letting people use RW smoothly, Not urgent, let's wait and see if there are more opinions on this, not just about this specific |
My main concern is that adding new things may break other things in unexpected ways, especially for SQL, a complex and not well-designed language. Anyway, such topic might unavoidably involve a lot of bikeshedding, and I agree we should decide the general attitude before talking about specific sugars. |
agree
also agree Now to elaborate on this specific topic:
Using the example @CAJan93 provided above:
|
This issue has been open for 60 days with no activity. Could you please update the status? Feel free to continue discussion or close as not planned. |
Update: Just confirming the 2 points above are still valid:
|
One clear reason NOT to support using aliases in WHERE: In #13653, we observe the following 2 queries have different semantics:
The following query would be misleading if alias was allowed in WHERE. It looks like
Additional notes:
|
Is your feature request related to a problem? Please describe.
SQL standard disallow alias in having clause and PG unable to do so, but it doesn’t hurt I suppose?
MySQL can do so.
Describe the solution you'd like
No response
Describe alternatives you've considered
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: