--把只有C=50,70的A 找出来。
select x.A
,x.C
,case when x.c = 50 then max(c.b) else min(c.b) end as B
from table x
,( select A , sum( decode( c,50,1,0)) as count50 ,sum( decode( c,70,1,0)) as count70
from table
where c in ('50','70')
) sub
where x.A = sub.A
and sub.count50 >0
and sub.count70 > 0
and x.c in ('50','70')
group by
x.A
,x.C
试试看,道理是这意思。没测试过
SELECT 表A.A, IIf([c]=50,Max([b]),Min([b])) AS BB, 表A.C
FROM 表A
GROUP BY 表A.A, 表A.C
HAVING (((表A.C)=50)) OR (((表A.C)=70));