Children for stupid on an example please (((

select

sum (case when v_f10=1 and floor (p1_101/1000) not in (1,2) then 1 else 0 end) gr1;

sum (case when v_f10=2 and p11_25 in (54,55) or (p11_25 in (49,50) and rab2 in (54,55)) then 1 else 0 end) gr2;

sum (case when p11_25=42 or (p11_25 in (49,50) and rab2=42) then 1 else 0 end) gr3

from f117

where mod (p1_10,10) in (4,5,7,24)

union all

select

sum (case when v_f10=1 and floor (p1_101/1000) not in (1,2) then 1 else 0 end) gr1;

sum (case when v_f10=2 and p11_25 in (54,55) or (p11_25 in (49,50) and rab2 in (54,55)) then 1 else 0 end) gr2;

sum (case when p11_25=42 or (p11_25 in (49,50) and rab2=42) then 1 else 0 end) gr3

from f117

where mod (p1_10,10) in (4,5,7,24)

and p1_10 in (4,5)

union all

select

sum (case when v_f10=1 and floor (p1_101/1000) not in (1,2) then 1 else 0 end) gr1;

sum (case when v_f10=2 and p11_25 in (54,55) or (p11_25 in (49,50) and rab2 in (54,55)) then 1 else 0 end) gr2;

sum (case when p11_25=42 or (p11_25 in (49,50) and rab2=42) then 1 else 0 end) gr3

from f117

where mod (p1_10,10) in (4,5,7,24)

and d111 in (20,30,40,72,73,74,75,76,77)

GR1 GR2 GR3

-------------------------------------- -------------------------------------- --------------------------------------

38998 213 151

22624 26 38

0 1 0