S
sean.howard
I want to delete records from a table that are in a list represented b
a subquery. Trying this in MS Access 2003 produced the following SQL:
DELETE dbo_Products_CategoriesAssoc.*
FROM dbo_Products_CategoriesAssoc, [Fix VTMM-5]
WHERE (((dbo_Products_CategoriesAssoc.ProductID)=[fi
VTMM-5].[productID]) AN
((dbo_Products_CategoriesAssoc.CategoryID)=[fi
VTMM-5].[categoryID]));
The [Fix VTMM-5] subquery is this:
SELECT dbo_Products_CategoriesAssoc.ProductID
dbo_Products_CategoriesAssoc.CategoryID, dbo_Attributes.Attribute
FROM (dbo_Products_AttributesAssoc INNER JOI
(dbo_Products_CategoriesAssoc INNER JOIN dbo_Categories O
dbo_Products_CategoriesAssoc.CategoryID = dbo_Categories.CategoryID) O
dbo_Products_AttributesAssoc.ProductID
dbo_Products_CategoriesAssoc.ProductID) INNER JOIN dbo_Attributes O
dbo_Products_AttributesAssoc.AttributeID = dbo_Attributes.AttributeID
WHERE (((dbo_Attributes.Attribute) Not Like "*all*") AN
((dbo_Categories.Category) Like "*all*") AN
((dbo_Products_AttributesAssoc.TypeID)=5))
ORDER BY dbo_Products_CategoriesAssoc.ProductID
dbo_Products_CategoriesAssoc.CategoryID;
Viewing the list of records produces the correct recordset. However
when I run this query, I get an error message: "Could not delete fro
the specified table." I can't figure out why this doesn't work
a subquery. Trying this in MS Access 2003 produced the following SQL:
DELETE dbo_Products_CategoriesAssoc.*
FROM dbo_Products_CategoriesAssoc, [Fix VTMM-5]
WHERE (((dbo_Products_CategoriesAssoc.ProductID)=[fi
VTMM-5].[productID]) AN
((dbo_Products_CategoriesAssoc.CategoryID)=[fi
VTMM-5].[categoryID]));
The [Fix VTMM-5] subquery is this:
SELECT dbo_Products_CategoriesAssoc.ProductID
dbo_Products_CategoriesAssoc.CategoryID, dbo_Attributes.Attribute
FROM (dbo_Products_AttributesAssoc INNER JOI
(dbo_Products_CategoriesAssoc INNER JOIN dbo_Categories O
dbo_Products_CategoriesAssoc.CategoryID = dbo_Categories.CategoryID) O
dbo_Products_AttributesAssoc.ProductID
dbo_Products_CategoriesAssoc.ProductID) INNER JOIN dbo_Attributes O
dbo_Products_AttributesAssoc.AttributeID = dbo_Attributes.AttributeID
WHERE (((dbo_Attributes.Attribute) Not Like "*all*") AN
((dbo_Categories.Category) Like "*all*") AN
((dbo_Products_AttributesAssoc.TypeID)=5))
ORDER BY dbo_Products_CategoriesAssoc.ProductID
dbo_Products_CategoriesAssoc.CategoryID;
Viewing the list of records produces the correct recordset. However
when I run this query, I get an error message: "Could not delete fro
the specified table." I can't figure out why this doesn't work