赞
踩
亲测有效。代码如下:
select a.id from app a
left join (select uid,id,name from weixin group by uid) b on a.id=b.uid
如上代码段所示,依据uid判断重复的记录,group by ,只显示一条记录。
若是group by查询较慢,也可这样写,在group by之前增加一个where条件,速度马上就上来。
select a.id from app a
left join (select uid,id,name from weixin where 索引条件 group by uid) b on a.id=b.uid
转载地址:https://blog.csdn.net/niuzaiwenjie/article/details/97240943
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。