0
我有2列像一個表,獲取導致給定的順序在MySQL
id | name
------------
1 | abc
2 | efg
3 | kkk
4 | lop
5 | xyz
查詢:
select id from name where name IN ('kkk','lop','xyz','kkk','efg');
給出的結果是:
2 | efg
3 | kkk
4 | lop
5 | xyz
預期的結果:
id | name
-------------
3 | kkk
4 | lop
5 | xyz
3 | kkk
2 | efg
任何想法?
可能重複[強制MySQL從WHERE IN子句中返回重複項而不使用JOIN/UNION?](http://stackoverflow.com/questions/2259160/force-mysql-to-return-duplicates-from-where- in-clause-without-using-join-union) –
[MySQL-INDER()中的ORDER BY值可能的重複](http://stackoverflow.com/questions/958627/mysql-order-by-values-within- in) – secelite
謝謝diiN_和secelite – xoreax