简体   繁体   English

合并来自多个表的数据

[英]Combining Data from multiple tables

I have two tables as follows TableA as我有两个表如下表A

col1 col2 col3 col4
1     2     3    4
101   201   301  401

AND another table- tableB和另一个表 - 表 B

col1 col2 col3 col4
1     2     3    4

Result tableC or result should be结果表C或结果应该是

Result结果

col1 col2 col3 col4 col5 col6 col7 col8

1     2    3    4    1    2    3     4
101   201  301  401  null null null  null

Basically want to save the common rows in the table wherever available.基本上想在可用的地方保存表中的常用行。 I am using MYSQL我正在使用 MYSQL

select * from TableA a left join TableB b
on a.col1 = b.col1 and a.col2 = b.col2 and a.col3 = b.col3 and a.col4 = b.col4

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM