如何按自己想要的顺序排序?
比如某一个有 A,B,C,D,E,F
我想按
D
C
B
E
F
A
排序,求sql 语句
[解决办法]
CREATE TABLE #temp (cstr CHAR(1))
INSERT #temp
SELECT 'A' UNION ALL
SELECT 'B' UNION ALL
SELECT 'C' UNION ALL
SELECT 'D' UNION ALL
SELECT 'E' UNION ALL
SELECT 'F'
SELECT * FROM #temp
ORDER BY CHARINDEX(cstr,'DCBEFA')