Björn Steinbrink wrote:
> You can use FIND_IN_SET to do that:
> SELECT * FROM tablename WHERE id IN (1,10,8,5)
> ORDER BY FIND_IN_SET(id, '1,10,8,5')
Björn, nice trick.
when I run that, the rows come out in the opposite order of my set:
mysql> select article_id from article where article_id in (202, 1000, 500, 200) order by find_in_set(article_id, '202, 1000, 500, 200');
+------------+
| article_id |
+------------+
| 200 |
| 500 |
| 1000 |
| 202 |
+------------+
4 rows in set (0.00 sec)
Do you know if that is normal?
Brian Moon
Phorum Dev Team
----------------------------------------------------------
MySQL.com uses Phorum. Why don't you?
http://www.phorum.org/
----------------------------------------------------------