第一种写法:SELECT USER_ID,USER_NAME FROM user WHERE USER_ID in (1008622115,1008610664,1008622031,100
第一种写法:
SELECT USER_ID,USER_NAME FROM user
WHERE USER_ID in (1008622115,1008610664,1008622031,1008610318)
ORDER BY INSTR(',1008622115,1008610664,1008622031,1008610318,',CONCAT(',',USER_ID,','))
第二种写法:
SELECT USER_ID,USER_NAME FROM user
WHERE USER_ID in (1008622115,1008610664,1008622031,1008610318)
ORDER BY field(USER_ID, 1008622115,1008610664,1008622031,1008610318)
--结束END--
本文标题: sql根据in 中的数据顺序显示
本文链接: https://lsjlt.com/news/40916.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
2024-10-23
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0