List:General Discussion« Previous MessageNext Message »
From:Jose Miguel Pérez Date:October 11 2005 3:24pm
Subject:Re: Append one table to another?
View as plain text  
Hi Brian!

> How do I append one table's contents to another? Both have identical
> structure. Problem is I don't have shell access, only phpAdmin or a
> PHP file I write & upload myself.

    You can do it this way:

        INSERT INTO table1 SELECT * FROM table2;

    If you need to have more control over what is copied, you can add a
WHERE clause in the SELECT above. Also, you can restrict how it is done by
adding some fields restrictions:

        INSERT INTO table1 (field1, field2)
            SELECT field1, field FROM table2
                WHERE field1 = <Some value>

    Cheers,
    Jose Miguel.

Thread
Append one table to another?Brian Dunning11 Oct
  • Re: Append one table to another?Paul DuBois11 Oct
  • Re: Append one table to another?Peter Brawley11 Oct
    • Re: Append one table to another?Brian Dunning11 Oct
      • Re: Append one table to another?Paul DuBois11 Oct
  • Re: Append one table to another?Jose Miguel Pérez11 Oct
    • Re: Append one table to another?Brian Dunning11 Oct