Drop the VALUES part in your second attempt:
INSERT INTO tbl1 (fld1, fld2, fld3, fld4)
SELECT 10306, fld2, fld3, fld4
FROM tbl1
WHERE fld1 = 8114
Note that you'll need to be running MySQL 4.0.14 or above to
insert into the same table you're selecting from.
____________________________________________________________
Eamon Daly
----- Original Message -----
From: "Ed Reed" <[EMAIL PROTECTED]>
To: <mysql@lists.mysql.com>
Sent: Tuesday, August 30, 2005 3:08 PM
Subject: Insert Into problem
Can anyone please tell me why this fails, I've done this type of thing
before without a problem
Insert Into tbl1 Select 10306, fld2, fld3, fld4 From tbl1 Where fld1=8114
tbl1 has five fields all ints with fld5 being the autoincrement index.
I've also tried it as,
Insert Into tbl1 (fld1, fld2, fld3, fld4)
Values(Select 10306, fld2, fld3, fld4 From tbl1 Where fld1=8114)
I think its obvious what I want but just in case, I want to duplicate all
the records where fld1 matches my value and assign all the duplicate records
a new value for fld1. When I do it the first way I get a "Column Count
doesn't match value count at row 1" error. When I do it the second way I
just get a syntax error.
Thanks!
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]