我有表产品 product_sn
对于每个产品都有一个或多个 sn (serialNumber) 所以让我们想象一下我的产品 id = 11, productName = 'milk' 我想将所有 serialNumber 从 produt_sn 复制到表 product
declare table product (
id int identity(1,1) primary key,
productName varchar(100),
serialNumber BIGINT
)
declare table product_sn (
serialNumber BIGINT
)
product_sn (
867635017749586,
867635017734984,
867635017753893,
867635017724894,
867635017749727,
867635017725289,
867635017752739,
867635017724761,
867635017756193,
867635017756268
)
declare @sn bigint
select @sn from product_sn
insert into product values (id,productName,@sn) ??