Skip to content

Instantly share code, notes, and snippets.

@dmitrybubyakin
Created September 8, 2016 06:36
Show Gist options
  • Save dmitrybubyakin/dd12e5c71590dee489e8a6f78e8bbea1 to your computer and use it in GitHub Desktop.
Save dmitrybubyakin/dd12e5c71590dee489e8a6f78e8bbea1 to your computer and use it in GitHub Desktop.
SELECT tmp.* FROM (
select _id as `certificate_id`,RegNumber, `Id` as `GUID`, ( select count(*)
from `certificatesupplement` cs
INNER JOIN `accreditedprogramm` ap on ap.certificatesupplement_id = cs._id
WHERE cs.certificate_id = ac._id ) as `Total`
from accreditationcertificate as ac) as tmp
where tmp.`Total` = 0
ORDER BY `tmp`.`certificate_id` ASC
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment