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...
精彩评论