Jump to content

new table from join query?


webguy262

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!

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.