SQL: INSERT INTO…VALUES..SELECT

后端 未结 4 1230
一向
一向 2021-01-01 13:23

How do i write INSERT statement if i get the values of colA from TableX, colB from TableY and colC from TableZ?

eg: INSERT INTO TableA (colA, colB, colC) VALUES (?,?

4条回答
  •  [愿得一人]
    2021-01-01 13:40

    You will need to join the tables that you want to make the selection from.

    Here is a resource on SQL joins:

    www.w3schools.com/sql/sql_join.asp

    You also might want to check out this free PDF book from the guys at www.simple-talk.com that covers SQL basics:

    SQL Server Crib Sheet Compendium

提交回复
热议问题