I'm not sure that I can do this in SQL but if I can it might be more efficient than looping in code. I have a two tables that are related via a third table.

The first table is for members and just has a bunch of personal info: name, address, email, etc... An ID column is the key.

The second table is for professional services each individual offers and also has an ID column which is the key

The third table has two columns... one for member IDs and the other for services IDs. Both columns are keys.

I have an editing form (webpage) that lists out professional services with a checkbox for each. I know I can loop through the results of an update form in ASP VBScript or ASP.NET and update each one that has been selected but I wonder if there isn't a more efficient and cleaner method of doing it with SQL.

I would need to:

  • insert a record if it doesn't exist and has been submitted from the form
  • remove a record if it does exist but hasn't been submitted

And that's about it. Not difficult to do with code but I think a little primitive.

Any ideas?

Thanks!