On Wed, Aug 13, 2003 at 08:24:48AM -0400, Brent Baisley wrote: > You can't insert select into a table you select from. So yes, you would > need to create a temp table first and them insert select from that. >
Actually, according to a recent user comment in the mysql documentation for INSERT ... SELECT, you now can do just that: >> Posted by Sandro Zic on Friday July 25 2003, @3:57am [Delete] [Edit] >> >> Actually, since MySQL 4.0.14, you can do INSERT ... SELECT with the >> same table name in the INSERT and SELECT statement: >> >> INSERT INTO table ( field ) SELECT field FROM table WHERE field = >> "data"; (from http://www.mysql.com/doc/en/INSERT_SELECT.html) Anyway, I have finally found the query that I was looking for! it works like this: mysql> insert ignore into owns (id, item) select p.id, '4' from person p; Thanks to all who replied for your help. --Fraser -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]