看板 Database 關於我們 聯絡資訊
資料庫是ms sqlserver 狀況是這樣的, 我下了一個查詢句 select * from reader where id in (3,4,1,2,9,5) 請問 我要如何使結果的順序 按照我 in 裡面的順序出現呢 我想要的結果是: reader: id, name --------- 3 namea 4 nameb 1 namec 2 named 9 namee 5 namef 感謝回答! 自問自答, 已解決了 最後是使用 order by case when id=3 then 1 when id=4 then 2 ... end end -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 220.130.139.12 ※ 編輯: drinks 來自: 220.130.139.12 (03/02 11:41)