SELECT `pay`.*
FROM `pay`
LEFT JOIN (select * from pay_service where pay_service.service in ('dipl')) as pay_service ON `pay_service`.`pay_id` = `pay`.`id`
WHERE pay_service.pay_id is null
GROUP BY `pay`.`id`
SELECT `pay`.*
FROM `pay`
LEFT JOIN `pay_service` ON `pay_service`.`pay_id` = `pay`.`id`
WHERE pay_service.pay_id is null AND `pay_service`.`service` not IN ('dipl')
GROUP BY `pay`.`id`