1

I have two databases: db1, db2 with the exact same columns/formatting.

Table names for db1 and db2 are : T1 and T2

Im comparing 3 columns from T1 and T2..When all 3 match exactly (date, col2, col3) then I want to COPY col4 and col5 from db2.T2 to db1.T1

I have this so far:

   INSERT INTO db1.t1 (col4,col5)

   SELECT db2.t2.col4, db2.t2.col5

   WHERE
      db1.t1.date=db2.t2.date AND
      db1.t1.col2=db2.t2.col2 AND
      db1.t1.col3=db2.t2.col3;

I'm getting 'Unknown column' in WHERE Clause error.

(And Im probably missing a JOIN)

Tip
  • 21
  • 4
Danny W
  • 463
  • 2
  • 6
  • 12

0 Answers0