Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9192419
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T20:55:07+00:00 2026-06-17T20:55:07+00:00

I need to generate XML file from all products in database (around 600 000).

  • 0

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

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T20:55:08+00:00Added an answer on June 17, 2026 at 8:55 pm

    Maybe you could play with GROUP_CONCAT:
    http://dev.mysql.com/doc/refman/5.0/en/group-by-functions.html#function_group-concat

    SELECT
      products.*,
      all_prod_categories.*
      all_prod_codes.*
    
    FROM products
    
    INNER JOIN
      (SELECT
         -- Who guarantees that all fields will be concated in the same order?
         -- Nobody :)
         GROUP_CONCAT( categories.id            ) AS all_prod_cat_ids,
         GROUP_CONCAT( categories.category_name ) AS all_prod_cat_names,
         ...
       FROM     categories
       GROUP BY categories.productid
      ) AS all_prod_categories ON categories.productid = products.id
    
    INNER JOIN
      (SELECT
         GROUP_CONCAT( codes.id        ) AS all_prod_code_ids,
         GROUP_CONCAT( codes.code_name ) AS all_prod_code_names,
         ...
       FROM     codes
       GROUP BY codes.productid
      ) AS all_prod_codes ON codes.productid = products.id
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to generate all my products from database table into the XML file.
Hello can anyone help me, i need to generate custom xml file from wordpress
I have an XML file, I need to extract values from it, and put
I need to generate an editable xml file to supply content to a flash
What tool do I need to generate XML intellisense help file as shown below?
I have a very large XML file that I need to parse so I
Hers my problem: we have a web service that we need to invoke from
I need to generate XML in the following form: <ns1:root xmlns:ns1=http://example.com/xmlns1 xmlns:ns2=http://example.com/xmlns2> <ns2:item ns2:param=value
Flex has an issue with hyphens in xml. I need to generate an xml
I need to generate an xsl table for the xml below, for attributes fname

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.