mssql sql语优化实例不使用insert语句(1/2)
/mssql sql语优化实例不使用insert语句
/*
create table tb_a
( owner char(2) null,
skuid varchar(10) null,
lot varchar(50) null,
quality varchar(2) null,
vol decimal(18,2) null,
vol_exchange decimal(18,2) null,
mysort int
)create table tb_b
( owner char(2) null,
skuid varchar(10) null,
lot varchar(50) null,
quality varchar(2) null,
vol decimal(18,2) null,
vol_exchange decimal(18,2) null,
mysort int
)INSERT INTO tb_a(owner,skuid,lot,quality,vol,vol_exchange,mysort)
VALUES ( '78 ', '1000164481 ', '071203 ', '0 ',80.00,70.00,1)
INSERT INTO tb_a(owner,skuid,lot,quality,vol,vol_exchange,mysort)
VALUES ( '78 ', '1000164481 ', '071202 ', '0 ',60.00,0.00,2)
INSERT INTO tb_a(owner,skuid,lot,quality,vol,vol_exchange,mysort)
VALUES ( '78 ', '1000164481 ', '081203 ', '0 ',30.00,30.00,3)
INSERT INTO tb_a(owner,skuid,lot,quality,vol,vol_exchange,mysort)
VALUES ( '78 ', '1000164481 ', '081202 ', '0 ',20.00,20.00,4)
INSERT INTO tb_a(owner,skuid,lot,quality,vol,vol_exchange,mysort)
VALUES ( '78 ', '1000164481 ', '081201 ', '0 ',10.00,10.00,5)INSERT INTO tb_b(owner,skuid,lot,quality,vol,vol_exchange,mysort)
VALUES ( '01 ', '1000164479 ', '091201 ', '0 ',18.00,6.00,6)
INSERT INTO tb_b(owner,skuid,lot,quality,vol,vol_exchange,mysort)
VALUES ( '04 ', '1000164481 ', '091201 ', '0 ',20.00,0.00,5)
INSERT INTO tb_b(owner,skuid,lot,quality,vol,vol_exchange,mysort)
VALUES ( '03 ', '1000164479 ', '091201 ', '0 ',26.00,26.00,4)
INSERT INTO tb_b(owner,skuid,lot,quality,vol,vol_exchange,mysort)
VALUES ( '02 ', '1000164479 ', '091201 ', '0 ',28.00,28.00,3)
INSERT INTO tb_b(owner,skuid,lot,quality,vol,vol_exchange,mysort)
VALUES ( '08 ', '1000164481 ', '091201 ', '0 ',60.00,0.00,2)
INSERT INTO tb_b(owner,skuid,lot,quality,vol,vol_exchange,mysort)
VALUES ( '06 ', '1000164481 ', '091201 ', '0 ',80.00,70.00,1)
GO
补充:数据库,Mssql