I have the following DB structure:
cars:
- id
- make
features:
- id
- name
cars_feature:
- id
- car_id
- feature_id
- value
I want to be able to select all cars with all features and return results with feature.name
as the column name and cars_feature.value
as the value. Right now I am able to get all feature and all values but I only figured out how to do that with group_concat
.
What I am looking for is the following output:
car_id car_make color wheels doors
1 Ford blue alloy
2 Audi alloy 3
Data example: SQLFiddle