AveragePro AveragePro -4 years ago 69
MySQL Question

MySQL JOIN two talbles

I hate asking for code but I just can't seem to do the below -

Staff

| lastname - name - position |
| Henderson | John | A |
| Howard | Bob | B |
| Hendry | Chris | B |


Max_person

| lastname - change |
| Henderson | John |
| Howard | Bob |
| Hendry | Chris |


I have been trying to JOIN these 2 tables - adding the "POSITION" column of staff to the end of max_person.

What is the query to use here?

Answer Source

Use:

SELECT mp.*,
       s.position
  FROM MAX_PERSON mp
  JOIN STAFF s ON s.name = mp.change
              AND s.lastname = mp.lastname
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download