alan_conoco@hotmail.co.uk wrote in news:1155133897.152618.77180
@m73g2000cwd.googlegroups.com:
Quote:
Hi all,
>
I am trying to delete a subset of records (identified using my
InsertRemovePairs query) from a table names TradesDone.
>
When I execute the nested SELECT on its own it returns the correct
records. When I execute is nested in the DELETE it tries to delete
everything in my database....
>
What have I missed??
>
DELETE TradesDone.*
FROM TradesDone
WHERE EXISTS (
SELECT TradesDone.*
FROM InsertRemovePairs, TradesDone
WHERE InsertRemovePairs.TradeID = TradesDone.TradeID
AND InsertRemovePairs.AggressorBrokerID = TradesDone.AggressorBrokerID
AND InsertRemovePairs.Action = TradesDone.Action);
I understand that "IN" and "EXIST" operators have become the new standard
in place of the more traditional JOINS, but I like my Joins and in many
cases I believe they are far more efficient and safe, if more difficult to
create.
Air (=untested) SQL from me would look something like
"DELETE td.* FROM TradesDone td " _
& "INNER JOIN InsertRemovePairs irp " _
& "ON td.TradeID = irp.TradeID " _
& "AND td.AggressorBrokerID = irp.AggressorBrokerID " _
& "AND td.Action = irp.Action
--
Lyle Fairfield