Copy row into another table

[prev] [thread] [next] [Date index for 2004/09/23]

From: Lance A. Brown
Subject: Copy row into another table
Date: 15:54 on 23 Sep 2004
I have a situation where I need to do the equivalent of:

insert into expired
   select NULL, NULL, clients.*
     from clients
     where client_id = ?

The two tables have the same columns except that expired has an 
expired_id (primary key, auto_increment) and a expired_time 
(TIMESTAMP) field, which is where the two NULL values in the select 
come in.

This is part of an expiration process where I need to archive the 
record being expired before deleting it from the clients database.  Is 
there a better way to do this in Class::DBI than:

my $expired = Expired->create( col1 => $client->col1,
                                col2 => $client->col2,
                                ...
                                colX => $client->colX );

This works, but is awful crufty.

--[Lance]
			
        -- 
          Celebrate The Circle: http://www.celebratethecircle.org/
  Carolina Spirit Quest:  http://www.carolinaspiritquest.org/
  My LiveJournal: http://www.livejournal.com/users/labrown/
  GPG Fingerprint: 409B A409 A38D 92BF 15D9 6EEE 9A82 F2AC 69AC 07B9

Copy row into another table
Lance A. Brown 15:54 on 23 Sep 2004

Re: Copy row into another table
Tony Bowden 17:32 on 23 Sep 2004

Re: Copy row into another table
Lance A. Brown 17:48 on 23 Sep 2004

Generated at 11:34 on 01 Dec 2004 by mariachi v0.52