My problem is the following: I have 2 Tables T1(idName) and T2(idName, name). I need to do an Insert in T1 with only the name and that the query compares if the name exists in T2 and get the idName to insert that value in T1. I have not tried anything yet because I have not found how to do it.

  • Please don't tag for multiple DBMSes, but rather only for the one you are actually using. – Colin 't Hart Jun 3 at 9:11
  • Do you already know how to find an idName in T2 when you are given a name? Just to find, without inserting the result anywhere. If you do, from that point it would be just one small step towards getting the insert statement. – Andriy M Jun 3 at 11:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.