2024-10-24 07:50:33
-- group 是关键字,最好不要用于列名
select t1.* from t1, (select t1.fgroup, t1.fitem, max(t1.c1) c1, min(t1.c4) c4
from T1, (select fgroup, fitem, max(c1) c1
from T1
group by fgroup, fitem) maxc1
where t1.fgroup = maxc1.fgroup
and t1.fitem = maxc1.fitem
and t1.c1 = maxc1.c1
group by t1.fgroup, t1.fitem) minc4
where t1.fgroup = minc4.fgroup
and t1.fitem = minc4.fitem
and t1.c1 = minc4.c1
and t1.c4 = minc4.c4;
2024-10-24 07:51:37
select * from t1 t where exists
(select 1 from
(select a.group,a.item,a.c1,min(a.c4) c4 from t1 as a,
(select group,item,max(c1) as c1 from t1 group by group,item) as b
where a.group=b.group
and a.item=b.item
and a.c1=b.c1
group by a.group,a.item,a.c1) c
where t.group=c.group
and t.item=c.item
and t.c1=c.c1
and t.c4=c.c4)
2024-10-24 07:59:07
2024-10-24 07:41:43