-1

Is it possible to insert values using multiple queries for different columns? MS SQL allows to write,

INSERT INTO TABLE1(COL1) 
SELECT COL1 FROM TABLE2

But what if I want to insert one data from one table, and another data from another table? Does MS SQL allow it? If so, what is the syntax?

mkRabbani
  • 16,295
  • 2
  • 15
  • 24

1 Answers1

0

You can write any select query like :

INSERT INTO TABLE1 (COLUMN1, COLUMN2) SELECT TABLE2.VAL1, TABLE3.VAL2 FROM TABLE2 INNER JOIN TABLE3 ON TABLE2.ID = TABLE3.FID

Ibrahim ULUDAG
  • 450
  • 3
  • 9