Exists and In subqueries

  • Thread starter Thread starter Ben
  • Start date Start date
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
 
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).
 
Back
Top