高手帮忙啊!!
表aa
id type_id
1 22
2 3
3 5
4 5
表bb(bb表class_id与aa表id关联 如:aa表中id 4 = bb表中的 class_id 4 )
id class_id
1 4
2 4
3 1
4 2
5 3
6 3
6 3
结果是
我想统计出 bb表中有多少条记录 但条件是 aa表的type=5
表aa
id type_id
1 22
2 3
3 5
4 5
表bb(bb表class_id与aa表id关联 如:aa表中id 4 = bb表中的 class_id 4 )
id class_id
1 4
2 4
3 1
4 2
5 3
6 3
6 3
结果是
我想统计出 bb表中有多少条记录 但条件是 aa表的type=5
(select id from aa where type='5')
Count(B.class_id)
From
A
Inner Join
B
On A.id = B.class_id
Where A.type=5