mokahola Posted August 22, 2006 Share Posted August 22, 2006 Hi,I have two tables, one for patches and one for mods, I want to merge these into one table. Each has the same structure, as follows:+-----------+-----------+-----------+| name | adddate | views |+-----------+-----------+-----------+|<name> | <date> | <views> ||<name> | <date> | <views> |+-----------+-----------+-----------+Now I want to combine them so that all the information is in one table, so I can order them by the adddate, and that the names of the patches and the names of the mods are in the same [name] column. The same goes for the other columns.I searched the internet and couln't find any thing about it, so maybe it isn't even possible.Thanks in advance.mokahola. Link to comment https://forums.phpfreaks.com/topic/18298-merging-two-sql-result-tables-that-have-the-same-fields/ Share on other sites More sharing options...
ShogunWarrior Posted August 22, 2006 Share Posted August 22, 2006 INSERT INTO table1SELECT *FROM table2Rename table1/table2 appropriately.table2 is the second table you want to merge with table 1.Then empty table2 and delete it. Link to comment https://forums.phpfreaks.com/topic/18298-merging-two-sql-result-tables-that-have-the-same-fields/#findComment-78628 Share on other sites More sharing options...
mokahola Posted August 22, 2006 Author Share Posted August 22, 2006 thnx, but I didn't want it in there permenently, but I fond a way:SELECT * FROM modsUNION ALLSELECT * FROM patches ORDER BY adddate Link to comment https://forums.phpfreaks.com/topic/18298-merging-two-sql-result-tables-that-have-the-same-fields/#findComment-78633 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.