S
S
Sergey K2016-11-10 16:31:44
MySQL
Sergey K, 2016-11-10 16:31:44

How to merge data from two tables?

I have table A and B. There is no connection between them, the only way to see the connection is that each table has a user_id column.
I need to make a selection from 2 tables and display the results in this way.
If in some of the tables there is no record by user_id from another table, then fill in the fields with NULLs.
If you use LEFT JOIN ON A.user_id = B.user_id and in table B there is a user who is not in A, then this record will not be displayed.
Likewise in reverse.
Is it really possible to make a SQL query?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey Gornostaev, 2016-11-10
@voodoo_dn

It looks like you need a full outer join .

A
Artem Klimenko, 2016-11-10
@aklim007

www.sql-tutorial.ru/ru/book_full_join_and_mysql.html

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question