34,838
社区成员




create table A(col int)
insert into A values(1)
insert into A values(2)
insert into A values(3)
insert into A values(80)
insert into A values(200)
insert into A values(3000)
go
select m1.col , m2.col , m3.col from A m1,A m2,A m3 ,
(
select mincol = min(abs(t1.col + t2.col + t3.col - 100))
from A t1,A t2,A t3
where t1.col < t2.col and t2.col < t3.col
) t
where m1.col < m2.col and m2.col < m3.col and abs(m1.col + m2.col + m3.col - 100) = t.mincol
drop table A
/*
col col col
----------- ----------- -----------
2 3 80
(所影响的行数为 1 行)
*/