Near-duplicate a row ?
| From: | Sigurd Magnusson | Date: | Mon, 22 Jan 2001 20:04:08 +0000 |
| Subject: | Near-duplicate a row ? | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-6036@lists.php.net to get a copy of this message | ||
Whats the easiest way to duplicate a row, specifiying only a new primary number?
Is the easiest way:
1. "SELECT * where primarykey=oldnum"
2. roll through the fields, getting current fields and values
3. "INSERT <fields/values> where primarykey=newnum"
... etc?
Or is there an SQL statement to achieve this ??
like "INSERT (SELECT statement) WHERE primarykey=newnum" ?
Or are you going to riducule, saying 'what the hell do you need near-duplicate rows for'?
:P
Siggy