select gg.h
from B gg , A mm
where gg.h=1 and
gg.f=mm.f and
mm.d>0
group by gg.h
having 2 * (select count(1) from mm where e between ('2005-01-01','2005-11-01')) >
(select count(1) from mm where e between ('2004-01-01','2004-11-01' ))
from B gg , A mm
where gg.h=1 and
gg.f=mm.f and
mm.d>0
group by gg.h
having 2 * (select count(1) from mm where e between ('2005-01-01','2005-11-01')) >
(select count(1) from mm where e between ('2004-01-01','2004-11-01' ))
select gg.f
from B gg , A mm
where gg.h=1 and
gg.f=mm.f and
mm.d>0
group by gg.f
having 2 * (select count(1) from mm where e between ('2005-01-01','2005-11-01')) >
(select count(1) from mm where e between ('2004-01-01','2004-11-01' ))