webguy262 Posted December 9, 2010 Share Posted December 9, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/221089-new-table-from-join-query/ Share on other sites More sharing options...
bh Posted December 9, 2010 Share Posted December 9, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/221089-new-table-from-join-query/#findComment-1144849 Share on other sites More sharing options...
webguy262 Posted December 9, 2010 Author Share Posted December 9, 2010 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! Quote Link to comment https://forums.phpfreaks.com/topic/221089-new-table-from-join-query/#findComment-1144920 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.