select name from table_A where id in (select t_id from table_b where id=81)查询结果:
-------
名称A
名称Bselect t_num from table_b where id=81查询结果:
-------
3
2------我需要以下的结果
名称A 3
名称B 2
-------
名称A
名称Bselect t_num from table_b where id=81查询结果:
-------
3
2------我需要以下的结果
名称A 3
名称B 2
)b where a.id=b.t_id
select a.name ,b.t_num
from table_A a ,table_b b
where a.id = b.t_id
and b.id=81
from table_A a ,table_b b
where a.id = b.t_id
and b.id=81
from table_a a , table_b b
where a.id = b.t_id and b.id = 81
a.NAME,b.t_num
FROM table_A AS a
INNER JOIN table_b AS b ON a.ID=b.t_id
WHERE b.ID=81
ss.t_num
from
(select name from table_A t where id in (select t_id from table_b where id=81)) tt,
(select t_num from table_b s where id=81) ss
select A.name, B.t_num
from table_A A
left join table_b B
on A.id = B.id
where B.id=81 楼主好好体会SQL其中的乐趣。