I have 2 tables one with all my products and their accociated details and another with comments on the products.
Product table 1
prodID, title, description, price
Comments table 2
commID, prodID, comment
I would like to export this to a single XML file, thus an XML element for each product from table 1 with all its comments in table 2 as child nodes within the product emelement:
<prods>
<prod>
<title></title>
<description></description>
<price></price>
<comments>
<comment></comment>
<comment></comment>
<comment></comment>
</comments>
</prod>
</prods>
I've tried a JOIN statement, but that returns a product row for each comment.
What is the correct SQL SELECT to return one product row with all its comment rows? Thanks...
Software/Hardware used:
MySQL5+, PHP5+
ASKED:
October 16, 2009 7:10 AM
UPDATED:
October 19, 2009 8:26 PM