No, it won't. You'll have to add an ORDER BY clause using
FIELD, like so:

SELECT prodname, price FROM prod_table
WHERE sku in ($sku1, $sku2, $sku3, $sku4)
ORDER BY FIELD(sku, $sku1, $sku2, $sku3, $sku4) ASC

For more information, see page 330 of the MySQL Cookbook, or
look for FIELD in the MySQL docs:

http://dev.mysql.com/doc/mysql/en/string-functions.html

____________________________________________________________
Eamon Daly



----- Original Message ----- From: "Grant Giddens" <[EMAIL PROTECTED]>
To: <mysql@lists.mysql.com>
Sent: Monday, March 28, 2005 11:43 AM
Subject: QUERY ordering clarification



Hi,

If I do a query like:

SELECT prodname, price FROM prod_table WHERE sku in
($sku1, $sku2, $sku3, $sku4)


Will my results always be ordered in $sku1, $sku2,
$sku3, $sku4 order? I can't really do a ORDER BY
prodname or price here.


I just want to make sure that that this type of query
will always return the results in $sku1, $sku2, $sku3,
$sku4 order.

Thanks,
Grant


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to