> I then want to delete these records from the source table.  I have tried 
> various permutations of:
> delete from sourcetable select * from sourcetable,targettable where 
> sourcetable.id=targettable.id;
> but with no luck.
> 
> The archive only seems to have questions relating to multi-table 
> deletes in 
> v4, and there is nothing about this in the manual or in Carsten's 
> FAQ.

Erhm, yes, there is - but it's not obvious in your context.
You're trying to use a subselect, which isn't supported in 
MySQL - yet.

>   Is 
> there a way of doing this?

At this time, no - not using MySQL directly. If you're
using some program to interface w/ MySQL, I would suggest
picking up the targettable.id's, collecting these in a
comma-separated list and use a query like:

DELETE FROM sourcetable WHERE id IN (<list>).

/ Carsten
--
Carsten H. Pedersen
keeper and maintainer of the bitbybit.dk MySQL FAQ
http://www.bitbybit.dk/mysqlfaq


---------------------------------------------------------------------
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