I'm trying to make a MySQL query that uses different group_concat with data from the same LEFT JOIN. An example tables could be:
Cars table carid | license_plate
Tires table (means used tires) carid | model | width
From these tables i want to obtain a list of tire models classified by their width, with the idea that there are only two different possible widths and I'm loading it from a car card page.
SELECT name,
if(width=205,group_concat(model ORDER BY model ASC),'') as width_205,
if(width=225,group_concat(model ORDER BY model ASC),'') as width_225,
FROM cars
LEFT JOIN tires ON cars.carid=tires.carid
WHERE carid='10'
I hope that my explanation is clear. This sentence doesn't work properly, and I don't know if it's because of a bad syntax or that I simply can't use group_concat this way.
Well, thanks for reading and I'll be waiting for your answers. Thanks in advance!