Now I should explain briefly what I want to do.
I have a table of "containers" (transmittals) and another table of "items" (documents) within each container.
I want to output a table listing all the containers with a column at the end of each row with a comma-space list of the items in the container. The purpose is to implement a simplistic search of the items in each container (using the datatables plugin).
I could of course query my containers table and during the "PHP while loop" I could secondary query the matching container id in the items table. Then I concatenate the items for each row, but I want to avoid multiple SQL calls.
So I created a right join (I write a simplified version below)...
SELECT transmittal.*, transmittal_documents.*
FROM transmittal RIGHT JOIN
transmittal_documents
ON transmittal_documents.transmittal_id = transmittal.transmittal_id
What is the best way to code my PHP while loop to only gather the unique "container" values in the table whilst concatenating the "items" using something like PHP join.
Or, perhaps I can do this in SQL before processing in PHP?
Thanks in advance for your assistance.