select service diags from diags join service on service serv_id diags

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
select service.*, diags.*
from diags
join service on service.serv_id = diags.serv_id
join rheader on rheader.ree_id = service.ree_id
join aitog_header on aitog_header.aitog_id = rheader.aitog_id
join medical on medical.med_id = diags.med_id
where
aitog_header.pay_date = '01.09.2008' and
diags.mprofil_cod in (284, 285) and
diags.serv_cnt > 1 and
service.pay_flg = 221 and
medical.med_name like '5%'