id | Product | PrdouctOption| ServiceId
1 | 1 | 1 | 12
2 | 2 | 1 | 12
3 | 1 | 1 | 13
4 | 2 | 1 | 13
5 | 1 | 2 | 14
6 | 1 | 1 | 15
How do I update all records in my table to insert a new row of product = 2 and productOption = 1 if it does not exist for a ServiceId. (in this case for serviceId 14 and 15)
I cannot seem to get a logic right.
So far this is what I have..
UPDATE dbo.MyTable
SET Product = 2, ProductOption = 1
//Can't figure out the logic for if it doesn't exist for a serviceid