MySQL order by two values

前端 未结 6 1890
清酒与你
清酒与你 2021-01-19 02:43

In short, I have a game of sorts, and the score board for it shows the score of the player at the end + how long they took to achieve it. I need to order my MySQL results so

6条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-19 03:21

    I think this is the best solution for arrange order by multiple value.

     SELECT * FROM hotel   
       WHERE confId=13   
       GROUP BY hotelName   
       ORDER BY CASE
       WHEN rating = '5 Star' THEN 1 WHEN rating = '4 Star' THEN 2   
       WHEN rating = '3 Star' THEN 3 WHEN rating = 'BUDGET & EQUIVALENT HOTELS' THEN 4 
     END
    

提交回复
热议问题