当前位置:网站首页>How does Mysql query two data tables for the same fields in two tables at the same time
How does Mysql query two data tables for the same fields in two tables at the same time
2022-08-03 08:02:00 【Brother Xin who writes python】
Foreword
Assume there are now two data tables
Table 1 is as follows:
Table 2 is as follows:
When both table 1 and table 2 are in mysql at the same time, only their uuid is the same, and other field information is different. Now you need to use sql statement to query the data that meets the requirements according to the uuid. How to do it?
sql statement to query two tables at the same time
Not much nonsense, follow the editor to continue reading
In fact, this kind of demand is still very common in work, but the method is actually very simple, the sql statement is as follows
select a.*, b.* from data table 1 name a, data table 2 name b WHERE a.uuid=b.uuid and a.webname='ChinesePhotovoltaic Industry Association';# Note: a.webname='China Photovoltaic Industry Association' here means that the webname field in data sheet 1 is the data of 'China Photovoltaic Industry Association'
Explanation as follows:
Generally, when we query the meeting, we select * from the data table. We need to query two tables here. As the name implies, we use a and b instead (such as a.* b.*), and the data table name is also followed by an a or b,Conditional statements are also followed by a or b.
After the above statement is successfully executed, the data that meets the requirements of the two tables is on one data table.
If you like this article or this article is helpful to you, remember to follow the editor and like it. If you have any questions or needs, please leave a private message.
边栏推荐
猜你喜欢
volta管理node版本
Data warehouse buried point system and attribution practice
Golang协程goroutine的调度与状态变迁分析
五、《图解HTTP》报文首部和HTTP缓存
PostMan使用,访问路径@RequestMapping
22-08-02 西安 尚医通(02)Vscode、ES6、nodejs、npm、Bable转码器
解决移动端有纵向滚动条但是不能滚动的问题
HCIP笔记整理 2022/7/20
加载properties文件,容器总结
The use of the database table structure document generation tool screw
随机推荐
mysqlbinlog: unknown variable 'default-character-set=utf8'
一文搞懂什么是@Component和@Bean注解以及如何使用
Roson的Qt之旅#106 QML在图片上方放置按钮并实现点击按钮切换图片
CDGA|如何加强数字政府建设?
MySQL or使索引失效
如何在安装GBase 8c数据库的时候,报错显示“Host ips belong to different cluster?
@Async注解的坑,小心
ArcEngine(六)用tool工具实现拉框放大缩小和平移
Neo4j 4.X:导入OWL文件
consul理解
如何使用电子邮件营销在五个步骤中增加产品评论
The ORB - SLAM2 extracting feature points
【图像去雾】基于matlab暗通道和非均值滤波图像去雾【含Matlab源码 2011期】
ArcEngine(二)加载地图文档
薛定谔的对象属性判断
面试介绍项目经验(转)
sqlserver2019安装失败
五、《图解HTTP》报文首部和HTTP缓存
HCIP笔记整理 2022/7/20
推荐系统-排序层-精排模型:LR、GBDT、Wide&Deep、DCN、DIN、DIEN、MMOE、PLE