MySQL Forums
Forum List  »  MyISAM

NEED TO SET ORDER OF SELECT QUERY according to the Arguments passing with IN (LIST)
Posted by: vikas sharma
Date: June 11, 2010 06:55AM

I am trying to find something definitive in the MySQL developer documentation about this to little avail.

I dont want to set the ORDER BY while Querying Table. my table has following fields.

table_urls
==================
id PRIMARY KEY
related_id
url
desc
=================

Table has indexed on primary key ID

when i run following query on table

===================================================================
SELECT id, related_id, url, title, stripped_body
FROM table_urls
WHERE id IN ('14037', '15596', '4956', '10719', '4349', '3496')
=====================================================================

The result is retrieved with default order by ID that is primary key (which is indexed)


Is there any option that i retrieve data in order of passing arguments like :

14037 comes first
15596 comes second
4956 comes third
10719
4349
3496

can anyone suggest me on this how can i get such result

Options: ReplyQuote


Subject
Views
Written By
Posted
NEED TO SET ORDER OF SELECT QUERY according to the Arguments passing with IN (LIST)
3562
June 11, 2010 06:55AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.