Hi Carlos,


>SELECT * FROM some_table WHERE field1 = 1 AND field2 > 0
>ORDER BY CONCAT(field1,field2) LIMIT 1

You have to give the concatenated field an alias name and use it in the
SELECT-subpart of your query, e.g.

SELECT field1, field2, concat(field1,field2) AS sortvar1 WHERE field1=1 AND
field2 > 0 ORDER BY sortvar1 LIMIT 1;

Maybe this can be optimized further to improve the query speed, but that's
another issue.


Regards
... Ralph ...



---------------------------------------------------------------------
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