| 发表于:2007-05-15 10:34:184楼 得分:5 |
create table t(tname char(1),num1 numeric(20,6),num2 numeric(20,6)) insert into t select 'a ',84,100 union all select 'a ',140,157 union all select 'a ',156,168 union all select 'b ',218.72,225 union all select 'b ',266.58,276 union all select 'b ',284.72,291 union all select 'c ',4,6 union all select 'c ',7,9 union all select 'c ',8,10 select identity(int,1,1)as tid,t.* into tb from t select a.tname,a.num1,a.num2 from tb a join tb b on a.tname=b.tname where a.tid <b.tid and a.num2> b.num1 | | |
|