Hi,
I have a local and remote table.
What I'm trying to accomplish is deleting anything from the local table that doesn't exist in the remote table.
Of course the easy way is to delete the entire local table and re-insert. But I have data attached in other tables that I need to leave intact.
I thought I had a solution but it only works on a single record. If there are more that two records in the local table, I get an error.
Any help or ideas would be appreciated.
Thank you,
I have a local and remote table.
What I'm trying to accomplish is deleting anything from the local table that doesn't exist in the remote table.
Of course the easy way is to delete the entire local table and re-insert. But I have data attached in other tables that I need to leave intact.
I thought I had a solution but it only works on a single record. If there are more that two records in the local table, I get an error.
Code:
DELETE tbl_PayType_Local.*
FROM tbl_PayType_Local
WHERE
(
tbl_PayType_Local.Pay_Type_ID=
(
SELECT
tbl_PayType_Local.Pay_Type_ID
FROM
tbl_PayType
RIGHT JOIN tbl_PayType_Local
ON tbl_PayType.Pay_Type_ID = tbl_PayType_Local.Pay_Type_ID
WHERE (((tbl_PayType.Pay_Type_ID) Is Null))
)
)
Any help or ideas would be appreciated.
Thank you,