List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:February 16 2003 8:15pm
Subject:Re: order by problem with 3.22
View as plain text  
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;

Thread
order by problem with 3.22sascha mantscheff16 Feb
  • Re: order by problem with 3.22Paul DuBois16 Feb
    • Re: order by problem with 3.22sascha mantscheff16 Feb