SQL 语句 a,b,c 三个字段多重判断
SQL 语句 a,b,c 三个字段多重判断
日期:2014-06-24 22:12:51 人气:1
--把只有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