I have a "Favourite Category" Table w/ a MemberID (it had a foreign key relationship to the MemberDetails MemberId field but i deleted it a few mins ago) and a MemberDetails Table with a Memberid Primary Key. I updated the Favourite Category table with MemberIds that do not exist in the MemberDetaisl table yet. I decided to remove those records, then re-add them only after creating the member Ids so I guess my question is 2 parts:
1.) How do I remove those records? This is the best query I could fathom which I'm sure has a million mistakes. Hell, the return is
"Server: Msg 156, Level 15, State 1, Line 1
Incorrect syntax near the keyword 'TABLE'." So much for that.
UPDATE TABLE FavCategory
DELETE ColumnId, MemberId
FROM FavCategory.MemberId = MemberDetails.MemberId
WHERE FavCategory.MemberId NOT IN MemberDetails.MemberId
Question 2 would be how to create a CHECK constraint so that I don't make these noob mistakes next time. Thanx!
1.) How do I remove those records? This is the best query I could fathom which I'm sure has a million mistakes. Hell, the return is
"Server: Msg 156, Level 15, State 1, Line 1
Incorrect syntax near the keyword 'TABLE'." So much for that.
UPDATE TABLE FavCategory
DELETE ColumnId, MemberId
FROM FavCategory.MemberId = MemberDetails.MemberId
WHERE FavCategory.MemberId NOT IN MemberDetails.MemberId
Question 2 would be how to create a CHECK constraint so that I don't make these noob mistakes next time. Thanx!