|
|
|
|
|
|
| Author |
Message |
Dan Buettner *nix forums Guru Wannabe
Joined: 13 Oct 2005
Posts: 119
|
Posted: Wed Jul 19, 2006 8:13 pm Post subject:
Re: mysql order question
|
|
|
Not sure there's a good way to do that ... here's one possible solution:
create a little extra table like so:
create table mytemptable
(mytemptable_id int not null auto_increment primary key,
table_id int,
key table_id_idx (table_id));
then insert your values for your IN clause into 'mytemptable' in the
proper order,
then issue a query that joins on that table and orders by the ID
number of the temp table:
select t.*
from table t, mytemptable mtt
where t.id = mtt.table_id
order by mtt.mytemptable_id
And finally delete your entries from your extra table so the next
query is accurate.
Not pretty eh?
Dan
On 7/19/06, OKAN ARI <liste@ari-tech.com> wrote:
| Quote: | I have a sql query like SELECT * FROM table WHERE id IN (4,88,23);
Result order in ID is: 4,23,88
But I need to receive result in order 4,88,23. So how can I manage to receive result in order LIKE IN() clause?
regards, okan
|
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=gcdmg-mysql@m.gmane.org |
|
| Back to top |
|
 |
OKAN ARI *nix forums beginner
Joined: 16 Sep 2005
Posts: 8
|
Posted: Wed Jul 19, 2006 7:03 pm Post subject:
mysql order question
|
|
|
I have a sql query like SELECT * FROM table WHERE id IN (4,88,23);
Result order in ID is: 4,23,88
But I need to receive result in order 4,88,23. So how can I manage to receive result in order LIKE IN() clause?
regards, okan |
|
| Back to top |
|
 |
Google
|
|
| Back to top |
|
 |
|
|
The time now is Thu Dec 04, 2008 1:42 am | All times are GMT
|
|
Credit Cards | Internet Advertising | Remortgages | Credit Cards | Loans
|
|
Copyright © 2004-2005 DeniX Solutions SRL
|
|
|
|
Other DeniX Solutions sites:
Unix/Linux blog |
electronics forum |
medicine forum |
science forum |
|
|
Privacy Policy
|
Powered by phpBB © 2001, 2005 phpBB Group
|
|