0

我有两张桌子:

TABLE A (columns: FirstValue, SecondValue, SeatNumber)

currently empty

TABLE B(1 column: SeatNumber)

Contains 300 rows with different numbers.

如何填充表 A,以便 FirstValue 和 SecondValue 分别为“1”和“2”,但 SeatNumber 是从表 B 中填充的?我假设这可以使用“选择进入”来完成。

建议?

4

3 回答 3

1
INSERT INTO A (FirstValue, SecondValue, SeatNumber)
SELECT 1,
       2,
       SeatNumber
  FROM B
于 2012-06-13T19:28:36.173 回答
0
insert into A(FirstValue, SecondValue, SeatNumber)
select '1', '2', SeatNumber 
     from B
于 2012-06-13T19:28:34.097 回答
0

您可以执行以下操作

INSERT INTO TABLEA (FirstValue, SecondValue, SeatNumber) 
SELECT
  '1',
  '2',
  SeatNumber
FROM
   TABLEB

希望这可以帮助!!

于 2012-06-13T19:29:43.213 回答