30分求一查询语句~~ select * from twhere id in(1,2,3)order by case when 3 then '' when 1 then '女人' when 2 then '男人' end 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 select * from (select * from table where1 id in(1,2,3)) a,(select * from table1 where id in (3,1,2)) b select * from twhere id in(1,2,3)order by case id when 3 then 0 else id end lsxaa(小李铅笔刀):这个是可以,但是如果我又很多条数据,想按照我规定的任意顺序排列,怎么办?那样的话每条都需要CASE 那就这样了order by charindex(','+cast(id as varchar)+',',','+客户指定+',') 这样看就明白了order by charindex((','+cast(id as varchar)+','),(','+客户指定+',')) 看看charindex函数就行了按照指定字段在字符串中的位置排序 求SQL在VIEW里面 获得平均值的语句 谢谢 求一个查询语句 SQL server如何将数据导出到http的某端口 求一统计sql语句! 去除数据库重复的数据的SQL语句 TONY兄或者高手请进,高难度求某进仓单结存情况 sql server死锁,求解 access区没人,版主别移动 备份集中的数据库备份与现有的 XX数据库不同 如何在两个结构完全一样的数据库之间实现追加数据? 求救!! 急!!! 谁见到过这种问题?非常奇怪
where id in(1,2,3)
order by case id when 3 then 0
else id
end
这个是可以,但是如果我又很多条数据,想按照我规定的任意顺序排列,怎么办?那样的话每条都需要CASE
order by charindex((','+cast(id as varchar)+','),(','+客户指定+','))