I need to insert a data into a DB using query like this one:
INSERT INTO Table1
(aID)
VALUES
(select aID from Table2 where aID="aID"))
The problem is that if Table2 doesn’t have the aID I need to update it with it and extract the newly created ID. Is there a SQL command that automatically does it?