您的位置:首页 > 其它

按时间排序返回前十条数据且不重复

2015-09-09 20:01 288 查看
select id,max(update_time) from table1 group by id order by date limit 10

select t.* from table1 t where update_time = (select max(update_time) from table1 where id= t.id) order by date limit 10

select t.* from table1t where not exists (select 1 from table1 where id= t.idand update_time > t.update_time) order by date limit 10
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: