开发者

insert 2 column primary key

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜