mysql分类读取最新一条数据
获取最新数据:
select id, name ,catalogue from `test` where id in
( select min(id) from `test` group by catalogue
如果是获取时间最靠前的数据,如下:
select id, name ,catalogue from `test` where id in
( select max(id) from `test` group by catalogue )
获取最新数据:
select id, name ,catalogue from `test` where id in
( select min(id) from `test` group by catalogue
如果是获取时间最靠前的数据,如下:
select id, name ,catalogue from `test` where id in
( select max(id) from `test` group by catalogue )