如何按照IN语句里的顺序进行排序
展开全部
mysql中按in顺序排列可以这样:
select * from table where id IN (3,6,9,1,2,5,8,7) order by field(id,3,6,9,1,2,5,8,7)
select * from table where id IN (3,6,9,1,2,5,8,7) order by field(id,3,6,9,1,2,5,8,7)
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
CREATE TABLE #T(id int identity,val int)
INSERT #T(val) VALUES(31132)
INSERT #T(val) VALUES(47100)
select *
from tab as a
join #T as b
on a.id=B.val
where a.price<99.0
order by b.id
INSERT #T(val) VALUES(31132)
INSERT #T(val) VALUES(47100)
select *
from tab as a
join #T as b
on a.id=B.val
where a.price<99.0
order by b.id
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询