这个sql怎么写?
回复讨论(解决方案)
select * from A left join B on A.id=B.id;
select * from A,B where A.id=B.id
SELECT A.id AS `aid` , A.name AS aname , B.p_id AS pid , B.id AS bid , B.session AS bsession FROM A,B WHERE A.aid=B.bid
select * from A left join B on A.id=B.id;
要从b表中找出符合session字段的
如果加上where b.session ='aaa
加这个条件的话a表中没有session字段,就光能列出b表的数据
selact * from a left join (select * from b where session='aaa') t on a.id=t.id