Select previous row mysql?

后端 未结 5 1189
猫巷女王i
猫巷女王i 2021-01-27 10:11

If I have a mysql table which had primary ids and another field called gameScore can I do something along the lines of...

SELECT gameScore FROM table1 WHERE id =         


        
5条回答
  •  逝去的感伤
    2021-01-27 10:36

    You're looking for the second lowest score, right? Like Craig mentioned, limit sounds like the right way to go:

    SELECT 
      gameScore 
    FROM 
      table1 
    WHERE 
      id = 100 
    ORDER BY 
      gameScore ASC 
    limit 1,1
    

提交回复
热议问题