Delete records based on query

mrkipling

Registered User.
Local time
Today, 06:27
Joined
Mar 19, 2003
Messages
22
Hi,

I'm getting really mixed up here, Im trying to delete all records in table products based on the following query;

SELECT products.*, tbl_stage_product_update.[Catalogue No]

FROM tbl_stage_product_update INNER JOIN products ON
tbl_stage_product_update.[Product Code] = products.pID

WHERE (((tbl_stage_product_update.[Catalogue No])="0"));

I've tried using the exists keyword with the previous query as a sub query, but it seems to delete all records form table products.

can anyone offer any advice.

TIA.

Mark
 
Not sure if I understood your problem correctly.

Try this Select query:-

SELECT *
FROM products
WHERE pID in (Select [Product Code] from [tbl_stage_product_update] where [Catalogue No]="0");


If it correctly displays all the records that you want to delete from the Products table, you can change the word SELECT to DELETE and run it.
.
 
Thats great, thanks Jon, much apreciated.
 

Users who are viewing this thread

Back
Top Bottom