Am Sonntag, 16. Februar 2003 21:15 schrieb Paul DuBois:
> 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;

thanks a lot, this does it.
s.m.

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to