Try:
SELECT *,
CONCAT(field1,field2) as newField
FROM some_table
WHERE field1 = 1 AND field2 > 0
ORDER BY newField LIMIT 1
I don't have access to my server right now but this SHOULD work.
HTH,
Cal
----- Original Message -----
From: "Carlos Savoretti" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, May 24, 2001 9:53 AM
Subject: Can I do this ?
> I'm using C API to access MySQL from another database in order to re-use
>
> a lot of existing software. Due the way the old database works I need
>
> a query be done like this:
>
> SELECT * FROM some_table WHERE field1 = 1 AND field2 > 0
>
> ORDER BY CONCAT(field1,field2) LIMIT 1
>
> This is for not to create a new field formed by field1+field2 because
>
> every time a row be updated, I would update this "key" field... (not
>
> sure about consistency).
>
> The point is that I've an error: syntax error near 'CONCAT(field1,...'
>
> What thing is wrong ?
>
> Regards
>
> [EMAIL PROTECTED]
>
> ---------------------------------------------------------------------
> 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
>
>
---------------------------------------------------------------------
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