mysql 如何查询A表uid等于表B里的uid的数据
一个表A 字段有id(1,2,3),uid(4,5,6)。一个表B 字段uid(4,5,6),name(C,D,E)。 如何查询表A里uid等于表B里的uid=4的数据 select * from 表A where uid=表B里的uid=4 这样的sql语句怎么写,写成一个语句
一个表A 字段有id(1,2,3),uid(4,5,6)。一个表B 字段uid(4,5,6),name(C,D,E)。 如何查询表A里uid等于表B里的uid=4的数据 select * from 表A where uid=表B里的uid=4 这样的sql语句怎么写,写成一个语句
答案:select A.* from A left join B on A.uid = B.uid where A.uid = 4
其他:select a.*,b,* from A a,B,b where a.uid=b.uid and b.uid=4; select a.*,b.* from a,b where a.uid=b.uid and b.uid = 4