sql server查询语句,

select [microblog] .dbo.sinanr .peison_id from sinanr where COUNT (peison_id )>50 group by peison_id
想查询在表sinanr中列peiso_id出现次数超过50次的person_id,可是弹出聚合不应出现在 WHERE 子句中,除非该聚合位于 HAVING 子句或选择列表所包含的子查询中,并且要对其进行聚合的列是外部引用的问题,想问是哪里出现错误

第1个回答  2012-04-26
语法错误,
select [microblog] .dbo.sinanr .peison_id
from sinanr
group by peison_id
having COUNT (* )>50
第2个回答  2012-04-26
基础知识
select [microblog] .dbo.sinanr .peison_id
from sinanr
group by peison_id
HAVING COUNT(peison_id )>50
第3个回答  2012-04-26
select [microblog] .dbo.sinanr .peison_id from sinanr group by peison_id having COUNT (peison_id )>50 你试一下
第4个回答  2012-04-26
select [microblog] .dbo.sinanr .peison_id from sinanr group by peison_id having COUNT (peison_id )>50本回答被提问者采纳
相似回答