List:General Discussion« Previous MessageNext Message »
From:Roger Baklund Date:October 4 2002 11:56am
Subject:Re: To Duplicate a Row?
View as plain text  
* Jan Steinman 
> Is there a simple way to duplicate one or more rows in a table?
> 
> I tried:
> 
>   INSERT INTO table SELECT * FROM table WHERE criteria
> 
> but apparently INSERT...SELECT cannot function on the same table.

Right, but you can use an intermediate temporary table:

CREATE TEMPORARY TABLE tmp1 SELECT * FROM table WHERE criteria
INSERT INTO table SELECT * from tmp1

-- 
Roger
sql
Thread
To Duplicate a Row?Jan Steinman3 Oct
  • Re: To Duplicate a Row?Roger Baklund4 Oct