Bug #3029 ORDER BY fails when using a string-handling function on an alias

Submitted: 1 Mar 2004 21:44 Modified: 2 Mar 2004 9:37
Reporter: [ name withheld ] Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:4.0.17 OS:Windows (Windows 2000)
Assigned to: Assigned Account CPU Architecture:Any

[1 Mar 2004 21:44] [ name withheld ]
Description:
The following query returns a valid result:

select amount as alias from import order by alias limit 5;

..however, this one honks:

select amount as alias from import order by concat('-',alias,'-');

..with:

ERROR 1054: Unknown column 'alias' in 'order clause'

I need to use the aliases because in another query where I use GROUP BY, I need to sort by a string-manipulated version of one of the aggregate fields. This is a big blocker to my project, so I'll provide whatever assistance I can.

How to repeat:
Make any query that tries to ORDER BY a string function taking a SELECT alias as a parameter.
[2 Mar 2004 9:37] Dean Ellis
This is a duplicate of #1743: http://bugs.mysql.com/bug.php?id=1743

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.038 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
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.