I am joining together three tables in order to display the names of recommended providers for a property.
First I join my
p) table to the
LEFT JOIN properties_recommended_providers pr ON pr.prop_id = p.id
I use a LEFT join to still get records of properties that don't have any recommended providers and wouldn't be in the properties_recommended_providers table.
Then I join with the recommended_providers table to get the names of the providers
LEFT JOIN recommended_providers rp ON rp.id = pr.recommended_provider_id
In the select clause I'm pulling info about each property (name, id, street, city, etc). Lastly, I want to list all the names of the recommended providers for each property in a final column which
My issue is that before selecting
rp.name I was getting distinct records for each record and now adding in
rp.name I'm getting multiple records for each property that have more than one recommended provider. The multiple property records contain identical information in every column except the
I know it's possible to concat together values from separate columns in a row and display that in a new column in a select query but in this particular case is it possible for any property with more than one recommended provider to have all those providers appear in one field together (separated by commas) for a single record for that property instead of having that property listed multiple times just to display each unique recommended provider ?