which does not have G1 rating but has G2 rating for each appointment date

with data as
(
select 111 as doc_id, to_date('23/12/2009', 'dd/mm/yyyy') as app_date, 'G1' as app_type from dual union all
select 111 as doc_id, to_date('23/12/2009', 'dd/mm/yyyy') as app_date, 'G2' as app_type from dual union all
select 111 as doc_id, to_date('23/12/2009', 'dd/mm/yyyy') as app_date, 'B' as app_type from dual union all
select 111 as doc_id, to_date('23/12/2009', 'dd/mm/yyyy') as app_date, 'D' as app_type from dual union all
select 111 as doc_id, to_date('23/12/2008', 'dd/mm/yyyy') as app_date, 'G1' as app_type from dual union all
select 111 as doc_id, to_date('23/12/2008', 'dd/mm/yyyy') as app_date, 'B' as app_type from dual union all
select 111 as doc_id, to_date('23/12/2007', 'dd/mm/yyyy') as app_date, 'G2' as app_type from dual union all
select 111 as doc_id, to_date('23/12/2007', 'dd/mm/yyyy') as app_date, 'B' as app_type from dual union all
select 111 as doc_id, to_date('23/12/2006', 'dd/mm/yyyy') as app_date, 'D' as app_type from dual
)
select doc_id ,app_date from data
group by doc_id ,app_date
having
count(case when app_TYPE='G1' AND app_TYPE !='G2' THEN 1 ELSE NULL END)=1