George,

What I would do is include an auto_increment column in the table and order
the select queries
by that column. I don't know of a way of doing what you want with existing
data.

John Lodge

-----Original Message-----
From: George Marnellos [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, March 12, 2002 4:00 AM
To: '[EMAIL PROTECTED]'
Subject: Order by list?



Hi all,

I'm executing the follow very simple type of query to select entries from a
list:

"select entryid, entryinfo from mytable where entryid in ('id7', 'id4',
'id2', 'id5')"

and, even though I don't specify any sorting order, MySQL sorts
alphabetically 
by the field "entryid" (which happens to be an index), i.e. it returns

+----------+-----------+
| entryid  | entryinfo |
+----------+-----------+
| id2        |       ... |
| id4      |       ... |
| id5      |       ... |
| id7      |       ... |
+----------+-----------+

I don't want this sorting order; I want the order to be that of the list. Is
there a
way to do this? It appears very simple but I cannot find how.


Thanks for any comments or help,
George

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

Reply via email to