I have 2 tables Transporter and Cars ,
I want to display all cars for a single Transporters in a single row
using joins I am getting cars all but in different row
I tried Group by clause but it is not working
What modifications Can i do in a query ?
I have 2 tables Transporter and Cars ,
I want to display all cars for a single Transporters in a single row
using joins I am getting cars all but in different row
I tried Group by clause but it is not working
What modifications Can i do in a query ?
Try using GROUP_CONCAT function like:
SELECT t.id, GROUP_CONCAT(car_name) AS Cars
FROM Transporters t INNER JOIN cars c
ON C.t_id = t.id
GROUP BY t.id
Output:
id Cars
1 car1,car3
2 car2,car4,car5