My understanding of why certain MySQL Joins do what they do is a bit scatterbrained.
I have multiple tables, ALM_RECORDS which has ID, and ALM_PHONES, ALM_ADDRESS both which have a column RecordsID that correlates to ALM_RECORDS's ID column.
Basically i need to pull from all 3 tables based on this ID. Below is my query, however it keeps returning duplicated entries threefold.
SELECT a.ID, a.FIRST_NAME, a.LAST_NAME,
b.RecordID, b.PHONESID, b.PhoneType, b.NUM,
c.RecordID, c.address_block, c.city, c.state, c.post_code, c.country
FROM ALM_RECORDS a
LEFT JOIN ALM_PHONES b
ON a.ID = b.RecordID
LEFT JOIN ALM_ADDRESS c
ON a.ID = c.RecordID
WHERE a.ID = "123456"
It's result should be:
123456 - John - Smith - Business - 111.222.3333 - address etc..
123456 - John - Smith - Home - 444.555.6666 - address etc..
but what i get is:
123456 - John - Smith - Business - 111.222.3333 - address etc..
123456 - John - Smith - Business - 111.222.3333 - address etc..
123456 - John - Smith - Business - 111.222.3333 - address etc..
123456 - John - Smith - Home - 444.555.6666 - address etc..
123456 - John - Smith - Home - 444.555.6666 - address etc..
123456 - John - Smith - Home - 444.555.6666 - address etc..
Can someone explain to me what i'm missing here? Should i be using a different type of join?