I have scoured the web looking for answers to this problem. i am suprised that it is so difficult to solve, and am hoping that I am missing something. I have a file of events that gets sent to me each month. It contains six months worth of listings. Most of the entries are already in the database. I need to insert the records that ARE NOT ALREADY THERE. I need to check that every column is the same! Sometimes many of the fields are the same(there may only be one or two that are different and they are not the same every time). I thought that this would work, but it returns all the rows.
SELECT StartDate,EndDate, [Town], Event, Description, Location, Time,
Cost, Phone, PhoneAlt, 1 as active
FROM tblInputEvents
where exists(select StartDate,EndDate, [Town], Event, Description, Location, Time,
Cost, Phone, PhoneAlt, 1 from tblEvents )
This seems like it would be a common problem with a simple solution, but I am not finding it. Any insight would be greatly appreciated.
SELECT StartDate,EndDate, [Town], Event, Description, Location, Time,
Cost, Phone, PhoneAlt, 1 as active
FROM tblInputEvents
where exists(select StartDate,EndDate, [Town], Event, Description, Location, Time,
Cost, Phone, PhoneAlt, 1 from tblEvents )
This seems like it would be a common problem with a simple solution, but I am not finding it. Any insight would be greatly appreciated.