Jump to content

Recommended Posts

Are there any shortcuts to taking the result of a join query and using it to create a new table?

 

Using pma I can obviously export the data, but what about the structure of the table?  Or at least the col names?

 

I guess I could export a SQL file for each table, and put them together in a text editor, right?

 

It would be great, tho, if I could do it all in one step from the result of the join query.

 

Link to comment
https://forums.phpfreaks.com/topic/221089-new-table-from-join-query/
Share on other sites

Hi,

 

Are there any shortcuts to taking the result of a join query and using it to create a new table?

You can create a table from a joined select query eg like that:

CREATE TABLE table_1 SELECT x.col FROM table_x AS x JOIN table_y AS y ON x.col2 = y.col2

 

Using pma I can obviously export the data, but what about the structure of the table?  Or at least the col names?

In php myadmin you at default you can export the structure of the table, anyway theres a structure fieldset under the export tab.

 

Thanks for the CREATE TABLE info. Just what I needed! 

 

The only pain was that the two tables had several common columns so although I wanted all the columns, I had to specify each individual columns I wanted, leaving out the common ones.

 

Thanks again!

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

  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.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.