Results 1 to 3 of 3

Thread: php sql

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Sep 2005
    Posts
    1,364

    php sql

    is there a way i can move a record from 1 table to another?

    both tables have the same table structure wth the same fields..

    do i have to do it the long way? i.e..

    grab all items from table1

    insert into table2 .....

    or is there a quicker way?

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: php sql

    You can run a few simple SQL statements to do this.

    INSERT INTO Table2(field1,field2,field3,field4)
    SELECT T1.field1,T1.field2,T1.field3,T1.field4 FROM Table1 T1 WHERE T1.field1 = 29385

    Then,

    DELETE FROM Table1 WHERE T1.field1 = 29385

    HTH

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Sep 2005
    Posts
    1,364

    Re: php sql

    Quote Originally Posted by mendhak
    You can run a few simple SQL statements to do this.

    INSERT INTO Table2(field1,field2,field3,field4)
    SELECT T1.field1,T1.field2,T1.field3,T1.field4 FROM Table1 T1 WHERE T1.field1 = 29385

    Then,

    DELETE FROM Table1 WHERE T1.field1 = 29385

    HTH
    awesome reply, perfect.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width