This syntax illustrates what I want to do, but is not allowed by SQL.
DELETE bt.* FROM basetable bt
INNER JOIN #work wk On bt.fld1 = wk.fld1 And bt.fld2 = wk.fld2 And bt.fld3 = wk.fld3
The correct DELETE statement using TSQL extension is below:
DELETE basetable
FROM basetable bt
INNER JOIN #work wk
ON bt.fld1 = wk.fld1 And bt.fld2 = wk.fld2 And bt.fld3 = wk.fld3
But best is to use the ANSI SQL syntax which doesn't have any ambiguity:
DELETE FROM basetable
WHERE EXISTS(SELECT * FROM #work as wk
WHERE wk.fld1 = basetable.fld1
AND wk.fld2 = basetable.fld2
AND wk.fld3 = basetable.fld3)
|||Ahhh!!! I tried so many variations .... except that one. Thanks.
No comments:
Post a Comment