create table test(编号 int,用功电度 int,无功电度 int,功率因数 decimal(10,2))
insert test
select 1,10000,9245,0.99 union all
select 2,12000,9500,0.98 union all
select 3,12500,9624,1.00 union all
select 4,13000,9725,1.00
--select * from test
select
max(用功电度)-min(用功电度) as 用功差值,
max(无功电度)-min(无功电度) as 无功差值
into # from test
select * from #