Hasta iki tarih arasında hastaneye ilk defa gelen hastaları listeyen sql listesi
select y.hasta,y.dosya_no,y.protokol_no,y.gtarih,y.poliklinik,y.doktor from
(select K.ADI||' '||K.SOYADI Hasta,a.dosya_no, a.protokol_no, (select count(*) from hastane.protokol x where x.dosya_no=a.dosya_no)KezGeldi,A.GTARIH,B.BOLUM_ADI Poliklinik,DR.ADI_SOYADI Doktor from hastane.protokol a,hastane.kimlik k,hastane.bolum b,hastane.dradi dr
where A.GTARIH BETWEEN to_date(:TAR1,'dd.mm.yyyy hh24:mi') and to_date(:TAR2,'dd.mm.yyyy hh24:mi') and A.dosya_no=K.DOSYA_NO and A.BOLUM=B.BOLUM and A.DR_KODU=DR.DR_kodu
)y where y.kezgeldi=1