mysql 多条件去重,然后需要返回最新的记录怎么搞

MySql 码拜 8年前 (2016-05-02) 1237次浏览
id     name         jingdu                  weidu                 date
1         aa          121.121              37.01234         2016-1-8
2        bb          121.120              37.01234         2016-9-8
3         cc          121.1211             37.01234         2016-10-8
4        dd          121.1121            37.01234         2016-9-23
5         ff             121.1121             37.01234         2016-9-1
6         ee          121.121               37.01234         2016-9-9
这么个表  怎么才能查到  这个经纬度的最新点呢?
各位高手帮帮忙
解决方案

20

select id, name,  max(date),  jingdu,  weidu  from table
group by   jingdu,  weidu

10

select * fjrom table a where id =( select id from table b where a.jindu=b.jindu and a.weidu=b.weidu order by date desc limit 1)

10

参考下贴中的多种方法
http://blog.csdn.net/acmain_chm/article/details/4126306
[征集]分组取最大N条记录方法征集,及散分…

CodeBye 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明mysql 多条件去重,然后需要返回最新的记录怎么搞
喜欢 (0)
[1034331897@qq.com]
分享 (0)