日期:2014-05-17 浏览次数:20516 次
select userid,productid, count(1) from test group by userid,productid having count(1)>5
------解决方案--------------------
select userid,productid, count(1) from test group by userid,productid having count(1)>5
------解决方案--------------------
;with TB as ( select userid,productid, (select count(1) from test a where a.userid =test.userid and a.productid=test.productid)as cs from test group by userid,productid ) select * from TB where cs>5