日期:2014-05-17 浏览次数:20629 次
select user.userid,count(opportunityID) as 订单总数 from UserTable as [user]
join Business_Opportunitys as opportunity
on user.userid = opportunity.userid
group by user.userid
select username,count(opportunityID) from UserTable where userid in(
select user.userid,count(opportunityID) as 订单总数 from UserTable as [user]
join Business_Opportunitys as opportunity
on user.userid = opportunity.userid
group by user.userid
)