How can I select the row with the highest ID in MySQL?

后端 未结 9 2066
故里飘歌
故里飘歌 2020-12-24 11:06

How can I select the row with the highest ID in MySQL? This is my current code:

SELECT * FROM permlog WHERE max(id)

Errors come up, can som

9条回答
  •  暖寄归人
    2020-12-24 11:23

    SELECT * FROM `permlog` as one
    RIGHT JOIN (SELECT MAX(id) as max_id FROM `permlog`) as two 
    ON one.id = two.max_id
    

提交回复
热议问题