热线电话:13121318867

登录
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;

5.9738
2
关注作者
收藏
评论(0)

发表评论

暂无数据
推荐帖子