Все. спасибо получилось. Просто невнимательность. Сначала делал через exists, не получилось, затем пытался шаманить зверски))) Спасибо, что свежим взглядом помогли. Вот код:
select distinct t4.abiturient, replace (personaldata.full_name, '_','') as FIO, t1.exem as OBSH, t2.exem as RUS, t3.exem as HISTORY, (t1.exem + t2.exem +t3.exem) as SUMMA
from ab_sysgroups t4
join ege_ocenki t1 on t1.pers_id = t4.abiturient
join ege_ocenki t2 on t2.pers_id = t4.abiturient
join ege_ocenki t3 on t3.pers_id = t4.abiturient
join personaldata on personaldata.id = t4.abiturient
where not exists (select t5.abiturient from ab_sysgroups t5 where t4.abiturient = t5.abiturient and t5.agroup = 3)
and t1.subj_id = 2
and t2.subj_id = 3
and t3.subj_id = 5
and t4.agroup =31
order by 2
Затупил в привязке друг к другу двух таблиц, написал неправильно сначала:
where not exists (select t5.abiturient from ab_sysgroups t5 where t5.agroup = 3)
Спасибо за подсказку