2019-03-04
阅读量:
674
sql语句的写法
问题描述:
要对两个字段进行排序,这两个字段分别为 uid和blogid。
uid和blogid 是通过点赞方式绑定的,因为之前没有进行判断一个人可以点多次,现在要对数据进行修正。
请问如何能够得到以下意图得到 同一个人对同一篇博客多次点赞的数据?
解决方法:
select t1.* from table1 t1 right join
(select * from
(select uid, blogid, count(id) as num from table1 group by uid, blogid) as t
where t.num > 1) t2
on t1.uid = t2.uid and t1.blogid = t2.blogid;






评论(0)


暂无数据
推荐帖子
0条评论
0条评论
0条评论