I apologize if the title of the question doesn't match the question but I didn't know how else to describe it. Here is an example of my database table which shows the item and an ID. The ID from the below table is actually from a defect table which has an ID and description. This is from a previous question I posted on EE where I was selecting reasons via checkboxes. For simplicity I have used "car" and "bike". In the real world these would be unique identifiers.
I want to present this data in a html table that would look like this:
Car Scratch, Broken window, burst tyre
Bike Broken light, Missing seat, Scratch
I tired using GROUP BY which helped to just show one of each thing instead of doing this:
but then it doesn't show all of the reasons, it only shows one.
My current SQL:
SELECT `product_no`, `commit_date`, `non_green_desc` FROM `non_green` AS ng INNER JOIN `non_green_reasons` AS ngr ON ng.`ng_id` = ngr.`ng_id` WHERE `complete_date` = ? GROUP BY `tank_no`