Hoping you can help a nube.
I have TableA with an FK that links to the PK of TableB,
So before insertion, I need to check if the values trying to be entered are already there on TableB, if not add a new one. In either case, afterwards I need to either grab the chosen existing record, or the newly created one and mark the FK of TableA with that ID value.
The reason why I have to do this check is because it doesn't just involve the FK value in relation to the PK on the other table, I have to check whether two separate field values are already on TableB that has the linked PK, not just one field. And the check is if BOTH fields are identical on TableB to what we wish to enter on it, don't add a record, use the existing one, or else add one.
Hoping this is a common and easy question. Thanks.