Jump to content
Sign in to follow this  
aneeb

How to get data from multiple tables

Recommended Posts

i want to fetch data from multiple tables. they all are similar that is they have same colum names (catalog_product_flat_1,catalog_product_flat_ 2,catalog_product_flat_ 3,catalog_product_flat_ 4.......), but they are not related.Is there any way to do this through stored prcedures or any other way. One more thing these tables will increse in future as the stores of my ecomerce site increases..please help me i am new to this...

Share this post


Link to post
Share on other sites

You need to list each table that you want information from, regardless of whether or not it is a union. It may be possible to write multiple queries or a stored procedure that would get all table names and find the ones you're looking for but I don't have experience doing something like that with stored procedures. It wouldn't be difficult to do that by using another script language to get all of the tables, build the query, and then run it.

Share this post


Link to post
Share on other sites
You need to list each table that you want information from, regardless of whether or not it is a union. It may be possible to write multiple queries or a stored procedure that would get all table names and find the ones you're looking for but I don't have experience doing something like that with stored procedures. It wouldn't be difficult to do that by using another script language to get all of the tables, build the query, and then run it.
you mean build a table of tables?

Share this post


Link to post
Share on other sites

The database already has a table that lists things like databases, tables, fields, etc. It's called information_schema. You can query that table to get metadata about the database and schema.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...