MySQL'IN'子句和返回的记录集顺序 [英] MySQL 'IN' clause and the returned record set order
本文介绍了MySQL'IN'子句和返回的记录集顺序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
例如:从T中选择*,其中T.id IN(4,78,12,45)
For example: select * from T where T.id IN(4,78,12,45)
我希望返回的记录集仅按"IN"子句中的位置排序. 我该怎么办?
I want the returned record set just order by the position in the 'IN' clause. How can I do this?
推荐答案
您可以使用虽然您必须重复该列表,但是如果您用代码生成查询,这不是一个大问题.
While you do have to duplicate the list, if you're generating the query in code this isn't a huge problem.
这篇关于MySQL'IN'子句和返回的记录集顺序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文