开发者

insert 2 column primary key

开发者 https://www.devze.com 2023-03-03 21:44 出处:网络
I want to insert 2 column primary key ( X and Y) in table A. X is inserted from table B and Y inserted开发者_如何学C from a fixed value..

I want to insert 2 column primary key ( X and Y) in table A. X is inserted from table B and Y inserted开发者_如何学C from a fixed value..

INSERT INTO A
  (X,Y) 
SELECT W 
  FROM table B, '1'


You were close:

INSERT INTO A
  (X,Y) 
SELECT W, '1'
  FROM table B

Define the static value -- in this example, the text "1" -- as a column in the SELECT clause.

Only one FROM clause per SELECT clause. Additional SELECTs need to be within brackets/parenthesis...

0

精彩评论

暂无评论...
验证码 换一张
取 消