我有一个像这样的表格参考表:
id - name - referred_id - referred_name
1 - mark - 100 - nick
2 - david- 100 - nick
3 - mat - 100 - nick
4 - patrik- 101 - robert
我想得到这样的结果:只显示referenced_id => 3条记录
refered_id - refered_name - Row(count)
100 - nick - 3
我的两个疑问:
"select count(*) as row(count) from Referral_info where row(count) > 3"
和
"select referred_id,referred_name from Referral_info"
如何才能将此查询加入一个? 感谢
答案 0 :(得分:0)
你在寻找小组吗?
select referred_id,referred_name , count(*) as RowsCount from Referral_info
group by referred_id,referred_name
having count(*) > 3