在查询语句加上 order by id desc

例如:

select * from table where useridr=58 and age=15 order by id desc

查出来第一条数据就是数据库里的最后一行