MySQL - ORDER BY values within IN()

前端 未结 6 1907
时光说笑
时光说笑 2020-11-27 10:46

I\'m hoping to sort the items returned in the following query by the order they\'re entered into the IN() function.

INPUT:

SELECT id         


        
6条回答
  •  刺人心
    刺人心 (楼主)
    2020-11-27 11:45

    Try something like

    ... ORDER BY (CASE NAME WHEN 'B' THEN 0 WHEN 'A' THEN 1 WHEN ...
    

提交回复
热议问题