Re: probably a simple mysql copy multiple rows question
| From: | Max Schwanekamp | Date: | Sun, 27 Nov 2005 18:06:41 +0000 |
| Subject: | Re: probably a simple mysql copy multiple rows question | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-226514@lists.php.net to get a copy of this message | ||
Dave Carrera wrote:
so if the output of my current table is BASE 600 1.99 BASE 601 2.99 then i would like to copy these rows so that the table looks like this BASE 600 1.99 BASE 601 2.99This is a SQL question, not PHP. That said, what you're describing is INSERT...SELECT syntax. In your example, something like: INSERT INTO mytable (name, code, price) SELECT 'NEW', code, '33' FROM mytable WHERE name = 'BASE' /* or whatever rows you need to copy */ Supported by MySQL, PostGres and others. -- Max Schwanekamp http://www.neptunewebworks.com/NEW 600 33 NEW 601 33