Unanswered: How to add columns to query based on value related table??
I have 3 tabels,
the relations are: company - complabels (1:n) labels_comp_labels (1:n), company-labels (m:n). I want to display all records in de companytable with added columns for the labels that apply per company, based on the labels table, joined by the comp_labels table.
To display all results, but per company multiple rows would be something like:
FROM TBL_labels RIGHT JOIN (TBL_company LEFT JOIN TBL_comp_labels ON TBL_company.com_id = TBL_comp_labels.comp_id) ON TBL_labels.label_id = TBL_comp_labels.label_id
But what I want is 1 row per company, displaying all the labelnames individually per column. Any thoughs?