Avoiding duplication of imported data
I'm sure I'm not the first person to have this issue, but I can't seem to find the right search terms to find a solution! Any help would be appreciated.
I have three (relevant) tables: Members, Events, and Attendance. Attendance is a join table between the other two, showing which members attended which events. This is similar to the Students/Classes examples I've seen about the place.
Data is imported to Attendance, as this is the closest match to our existing setup: we receive a list of people who attended an event, details about their profession, and the relevant event_id (the Event record will already have been created prior to receiving this info).
The list of people attending may be a mix of people who are brand new to our client list, or who have attended previous events and will therefore already have a record in the Members table. I want to create Members records for the new people and prevent any changes from happening to the details of existing Members.
- list of people added to Attendance join table
- see if they are in Members table:
-- if so, do nothing
-- else, add new record in Members using data from Attendance
How do I accomplish this?