table a:
id name type
1 1tom 1
2 2tom 2
3 3tom 2
4 4tom 1
table b:
id a_id(FK 对应a表的id)
1 1
2 1
3 2
4 3
查询 a表中 type=2 所对应的 b表的记录
table a:
id name type
1 1tom 1
2 2tom 2
3 3tom 2
4 4tom 1
table b:
id a_id(FK 对应a表的id)
1 1
2 1
3 2
4 3
查询 a表中 type=2 所对应的 b表的记录
写错了哦
[code="sql"]SELECT b.*
FROM a,
b
WHERE a.id = b.a_id
AND a.TYPE = '2'[/code]