简体   繁体   中英

Combining Data from multiple tables

I have two tables as follows TableA as

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

AND another table- tableB

col1 col2 col3 col4
1     2     3    4

Result tableC or result should be

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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