Hi.

On Thursday 05 July 2007 17:35, you wrote:
> > I want to delete from the 'Item' table
> > all the items identified by the folowing query:
>
> If you have MySQL 5+, you can do it using a sub-query:
>
> DELETE FROM
>   Item
> WHERE
>   ProductID IN (
> SELECT
>     Item.ProductID
> FROM
>     Item, ItemTag
> WHERE
>     ItemTag.TagID = '168'
> AND
>     ItemTag.ItemID = Item.ProductID
> );

I'm on 4.1 due to host restrictions, but for both versions the manual page 
on subquery syntax says

"Another restriction is that currently you cannot modify a table and select 
from the same table in a subquery. This applies to statements such as 
DELETE, INSERT, REPLACE, UPDATE"

which seems to me would stop your suggestion working. Am I misunderstanding 
(perfectly possible, as I'm a long way from expert)?

Thanks for the quick reply anyway,

Mark

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to