http://www.mysql.com/doc/en/INSERT_SELECT.html

You cannot select from the table you are inserting into.  Insert into a temp
table and then insert into holds from that table.

-----Original Message-----
From: Eric [mailto:[EMAIL PROTECTED]]
Sent: Thursday, November 21, 2002 1:14 PM
To: [EMAIL PROTECTED]
Subject: INSERT INTO () SELECT...



Hi,

This should work, I think, but doesn't


INSERT INTO holds (ord_num)
SELECT orders.ord_num FROM orders
LEFT JOIN holds ON orders.ord_num = holds.ord_num
WHERE holds.ord_num IS NULL

I have some order numbers that are not in holds that are in orders. I want
to make entries in holds to match those missing.

The above SELECT gives me exactly what I want, but I get

ERROR 1066: Not unique table/alias: 'holds'


Thanks,

Eric


mysql,sql why because we love you!





---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail
<[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to