SQL语句连接查询问题
select * from A join B on A.id in (B.sid);
怎么实现连接查询的时候,像where一样用in来做连接两张表的条件
回答
如果我没理解错你的问题的话,你这个直接用等于就可以了
select * from A join B on A.id=B.sid
如果你只是想查询A表的数据,那么你可以这样
select * from A where Id in (select sid from B)
或
select * from A where exists (select 1 from B where B.sid=A.Id)