一个表格tableA
id B_id 一个表格tableB
id C_id一个表格tableC
id row2
tableA.B_id 对应tableB.id
tableB.C_id 对应tabelC.id请问一下 我怎么去查找出这样一个结果:
每个tableC.id 对应的count(*) 在tableA中的记录数两个表格的话可以group by
三个表格的话不知道如何操作啦~~~~语句如下:select count(*) from tableA where tableA.B_id in(select tableB.id from tableB where tableB.C_id=***)
这个语句是一个个tableC.id 去统计的,当然不可能这样啦~~谢谢!!
id B_id 一个表格tableB
id C_id一个表格tableC
id row2
tableA.B_id 对应tableB.id
tableB.C_id 对应tabelC.id请问一下 我怎么去查找出这样一个结果:
每个tableC.id 对应的count(*) 在tableA中的记录数两个表格的话可以group by
三个表格的话不知道如何操作啦~~~~语句如下:select count(*) from tableA where tableA.B_id in(select tableB.id from tableB where tableB.C_id=***)
这个语句是一个个tableC.id 去统计的,当然不可能这样啦~~谢谢!!
Select Count(1) from tableA a,tableB b,tableC c
where a.B_id=b.id and b.C_id=c.id
tableC的第二列 count的数目(tableA)能不能这样的呢???
from tableA A,tableB B,tableC C
where A.B_id=B.id and B.C_id=C.id
group by C.id
from tableA A,tableB B,tableC C
where A.B_id=B.id and B.C_id=C.id
group by a.id
select count(*)
from tableA A,tableB B,tableC C
where A.B_id=B.id and B.C_id=C.id
group by C.id
好像不行吧~~
from tableA a,tableB b,tableC c
where a.B_id = b.id
and b.C_id = c.id
group by c.id;