Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2012
    Posts
    1

    Unanswered: inserting into one table when 2 values from 2 other tables are equal

    Hi

    I want to do something similar to this:
    insert into table1 (value)
    from table2 (value) where table2.value1 = table3.value1 and table2.value2 = table3.value2

    ive been trying for several days now and just cant get it right.

    can anyone help?

    Thanks

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    Code:
    INSERT 
      INTO table1 
         ( t1column )
    SELECT table2.somecolumn
      FROM table2 
    INNER
      JOIN table3
        ON table3.value1 = table2.value1 
       AND table3.value2 = table2.value2
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •