At 20:43 +0100 2/16/03, sascha mantscheff wrote:
>The following query works with mysql 3.23:
> SELECT * FROM answer ORDER BY concat( n_sort, "-", id_answer )
>It does not with mysql 3.22.27. Neither does any query with a function call
>in the order by clause. Is this documented somewhere? Am I missing something?
>Is there a workaround other than upgrading to 3.23?
Functions in ORDER BY are allowable as of MySQL 3.23.2:
http://www.mysql.com/doc/en/News-3.23.2.html
Prior to that, the workaround is to include the expression in the output
column list, alias it, and refer to the alias in the ORDER BY clause:
SELECT *, concat( n_sort, "-", id_answer ) AS expr
FROM answer ORDER BY expr;