Bug #43038 | The aliases on the fields does not work on where clause | ||
---|---|---|---|
Submitted: | 19 Feb 2009 22:02 | Modified: | 19 Feb 2009 23:24 |
Reporter: | Amir Aram | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | MySQL Server | Severity: | S2 (Serious) |
Version: | 5.1.31 and 5.1.x and 5,0,67 and later | OS: | Any |
Assigned to: | CPU Architecture: | Any | |
Tags: | Aliases definitions on fields and using it in where clause |
[19 Feb 2009 22:02]
Amir Aram
[19 Feb 2009 23:24]
MySQL Verification Team
Thank you for the bug report. That behavior is according the SQL Standard and commented clearly in our Manual. Please see: http://dev.mysql.com/doc/refman/5.0/en/problems-with-alias.html " Standard SQL doesn't allow you to refer to a column alias in a WHERE clause. This restriction is imposed because when the WHERE code is executed, the column value may not yet be determined. For example, the following query is illegal: SELECT id, COUNT(*) AS cnt FROM tbl_name WHERE cnt > 0 GROUP BY id;"