Help in query

I am inserting records into a table from another table through a procedure. While inserting I also need to add few additional columns into destination where one of the additional column value should get from another table through a query based on the existing field.

Source Destination
C1 C1

Here I have to take value for C2 from another table based on C1 value


Can some one help in writing query to get C2 based on C1 for insert.


Please provide:

  • table definitions in the form of create statements
  • sample data in the form of insert statements
  • expected output from the sample data you provide
  • the query you got so far and possible errors you get