MySQL: Get most recent record

后端 未结 7 1728
情歌与酒
情歌与酒 2020-11-28 20:42

In the table below, how do I get just the most recent record of id=1 based on the signin column and not all 3 records?

+----+--         


        
7条回答
  •  清酒与你
    2020-11-28 21:18

    I had a similar problem. I needed to get the last version of page content translation, in other words - to get that specific record which has highest number in version column. So I select all records ordered by version and then take the first row from result (by using LIMIT clause).

    SELECT *
    FROM `page_contents_translations`
    ORDER BY version DESC
    LIMIT 1
    

提交回复
热议问题