当前位置:网站首页>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.
边栏推荐
猜你喜欢
随机推荐
postman将接口返回结果生成json文件到本地
sqlite 日期字段加一天
[Hello World] 二分查找笔记
Roson的Qt之旅#105 QML Image引用大尺寸图片
JS作用对象API技巧
pgaudit 的安装使用《postgresql》
剑指offer专项突击版第18天
学习笔记:机器学习之逻辑回归
华为设备BFD配置命令
2022年 SQL 优化大全总结详解
薛定谔的对象属性判断
pyspark---encode the suuid interval (based on the number of exposures and clicks)
redis AOF持久化个人理解
安全狗云原生安全能力全面亮相全球数字经济大会暨ISC互联网安全大会
Oracle Rac 集群文件目录迁移
consul理解
sqlserver2019安装失败
用云机器/虚拟机架设方舟游戏?
Oracle Rac Cluster File Directory Migration
智能客服,还有多少AI泡沫?