Exists and In subqueries

B

Ben

Hi,

I need some help on how to overcome the same table name where using Exists
subqueries. For some reasons,
I can't change the table and field name in the temp.mdb. Please help.

My code is :
Delete SalesOrder.*
FROM SalesOrder
WHERE ((Exists (Select 1 from SalesOrder in "C:\Temp.mdb" where (soref
=SalesOrder.Ref
And CustID = SalesOrder.CustID ))) <> False);



Thank you in advance for any help.

Ben
 
J

John Vinson

I need some help on how to overcome the same table name where using Exists
subqueries. For some reasons,
I can't change the table and field name in the temp.mdb.

Use an Alias:

Delete SalesOrder.*
FROM SalesOrder
WHERE ((Exists (Select 1 from SalesOrder in "C:\Temp.mdb" AS
TempSalesorder where (Tempsalesorder.soref=SalesOrder.Ref
And TempSelsesorder.CustID = SalesOrder.CustID )));

The <> False isn't necessary - the EXISTS clause will return True
(delete the record) or False (don't).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top