I am working on a data export and need to return the values from a lookup table were there are multiple values to lookup from the same table in a single row.
Example

I essentially need to replace the 3 id columns with values from the lookup table keeping to a single row in the export.
Help is appreciated.
SELECT p.ID,
p.NAME,
q1.QualName,
q2.QualName,
q3.QualName
FROM people p
LEFT JOIN qualities q1
ON q1.QualID = p.QualityID1
LEFT JOIN qualities q2
ON q2.QualID = p.QualityID2
LEFT JOIN qualities q3
ON q3.QualID = p.QualityID3;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With