this is so stupid and simple and I am annoyed over having to spend so much on this silly simple stuff.
I am sure I am just making a silly mistake.
I am trying to remove records from one table. The table holds 19000 something records.
To determine WHICh records to delete, I have another table that contains the 45 I want to delete.
So I wrote this very simple query
Delete from tbl_X
where tbl_X.FieldA = tbl_Y.FieldA;
The message I get is:
Msg 4104, Level 16, State 1, Line 1
The multi-part identifier "tblY.FieldA" could not be bound.
Please tell me I am stupid!
Thanks!
tbl_Y needs to be mentioned as a table in a FROM clause or a JOIN clause. Perhaps you want something like
DELETE FROM tbl_X
WHERE tbl_X.FieldA IN (SELECT FieldA FROM tbl_Y)
HTH,
Don
|||I've always coded a delete like this as a join:
DELETE tbl_X
FROM tbl_X INNER JOIN tbl_Y
ON tbl_X.FieldA = tbl_Y.FieldA
|||THANKS!
And thanks for the quick reply!
Richard
|||THANKS!
And thanks for the quick reply!
Richard
No comments:
Post a Comment