50分怪问题,UP有分!SQL语句
现有这样一条SQL语句:select * from question where qt_id in (26,1,2,12,19)
得出来的表的顺序是按qt_id的从小到大顺序排的,可是我想得到的顺序和括号中的顺序一样(就是表中行按qt_id=26,1,2,12,19这样的顺序),请大家指教!
------解决方案--------------------有點問題,修改下,這樣更保險些。
select * from question where qt_id in (26,1,2,12,19) order by CharIndex( ', ' + Cast(qt_id As Varchar) + ', ', ',26,1,2,12,19, ')