You need to merge 2 columns into one and merge with another table. I found how to merge 2 columns into 1, but how to merge is not clear.
Merge 2 columns into 1:
SELECT concat(name,' ', surname) as 'Name Surname' FROM `user`;
My attempts to join with 2 columns of another table
SELECT device.OS FROM `user` RIGHT JOIN device ON user.name = device.name;
How to do it in 1st request???
CodePudding user response:
The unique value in your records seems to be the Phone and phone_number, and not the Name.
This is where you need to JOIN them.
It is where there is a match on the left table (users) with the right table (devices), based on the columns Phone (from users table) and phone_number (from devices table).
SELECT CONCAT(u.Name, " ", u.Surname) AS 'Name Surname', d.OS
FROM users u
JOIN devices d
ON u.Phone = d.phone_number
