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