Search code examples
mysqljoin

How to join only one column?


SELECT * FROM table1
LEFT JOIN table2
ON table1.id = table2.table1_id
WHERE table1.id = 1

I need to join only one column from table 2, say first_name. How can I do that?


Solution

  • Assuming that you mean "select one column from table 2":

       SELECT table1.*, table2.first_name
         FROM table1
    LEFT JOIN table2
    ...