求助各位大侠:按照A表的某一键值统计在C表出现的总数
有A,B,C三张表中,A.sn=B.index, B.ip=C.ip
按照A表的sn,分别统计在C表中的总数。
[解决办法]
select a.sn,count(c.ip)from a,b,cwhere A.sn=B.index and B.ip=C.ipgroup by a.sn
[解决办法]
select a.sn,c.cntfrom ajoin b on A.sn=B.[index]join (select ip,count(1) as cnt from c group by ip) c on b.ip=c.ipgroup by a.sn,c.cnt
[解决办法]
select a.sn,count(c.ip)from a,b,cwhere A.sn=B.index and B.ip=C.ipgroup by a.sn
[解决办法]
select a.sn,count(c.ip)from ainner join b on A.sn=B.index inner join c on B.ip=C.ipgroup by a.sn