MySQL move record from one table to another

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
Crew
Forum Newbie
Posts: 16
Joined: Fri Jul 15, 2005 4:05 am

MySQL move record from one table to another

Post by Crew »

Hi Guys

I have the ID of the record i want to move from one table to the other but I do not know how to transfer it. There must be a simple way other that selecting everything from the first table, making them into variables, inserting into the second then deleting the first.

I've had a look at SELECT * INTO $helpdesk_submission FROM $helpdesk WHERE id='$id' but this does not seem to work, or is not compatable with MySQL.

I'm using MySQL 4.0.20

Thanks for any ideas you may have
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Crew
Forum Newbie
Posts: 16
Joined: Fri Jul 15, 2005 4:05 am

Post by Crew »

ok so now I have

INSERT INTO test_helpdesk SELECT test2_helpdesk.* FROM test2_helpdesk

how do i get the ID to auto increment and start from the next ID int he table test_helpdesk. There are a lot of columns in test2_helpdesk so is there an easy way?
Post Reply