I need to generate XML file from all products in database (around 600 000). Problem is that i need to put into that file for every product his categories and his codes. Some products have 30 categories and 10 codes and that really hurts. Is it possible somehow to make this in single effective query or can you give me a tip how to improve my current solution:
SELECT * FROM products
and then for every product Im fetching codes and categories:
SELECT * FROM categories WHERE productid=[productid]
and
SELECT * FROM codes WHERE productid=[productid]
Thanks for any advices
Maybe you could play with
GROUP_CONCAT:http://dev.mysql.com/doc/refman/5.0/en/group-by-functions.html#function_group-concat