Select ProContent_name From ProContent where ProContent_ID in (9336,1137,8440) 这样搜索出来的数据 默认是按1137 8440 9336 来排序 如何是上面的语句按照输入的顺序来排 如:上面的语句的排序是9336,1137,8440 来排 我现在用的方法是截掉 按union all 来链接,有其他方法吗?
Select ProContent_name From ProContent where ProContent_ID in (9336,1137,8440) order by charindex(convert(varchar(100),ProContent_ID),('9336,1137,8440'))
Select ProContent_name From ProContent where ProContent_ID in =9336
union all
Select ProContent_name From ProContent where ProContent_ID in 1137
union all
Select ProContent_name From ProContent where ProContent_ID in =8440