select * from A inner join B on (A.Id=B.Aid) where A.age<16 and B.所选课程=数学
(A.Id=B.Aid)是A表和B表的关系
Sql语句是这样的
做表连接后COUNT,看你外连内连前连后连了,总数会因连接方式不同而不同。
sql="select * from A表 where A.年龄<16 and B.课程='数学'"
select * from A a inner join B b on(a.id=b.id) where a.age<16 and b.课程='数学'