当前位置:数据库 > MySQL >>

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语句怎么写,写成一个语句
答案: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

上一个:sql语句问题,mysql中的sql语句
下一个:mysql存储过程 循环 这个错哪儿了?

CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,