Created
September 5, 2016 05:26
-
-
Save dmitrybubyakin/8f50e8d40c8424cf9ff4ef35cfd01eaf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. Выдает список свидетельств и кол-во программ | |
select | |
_id, | |
`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 | |
order by _id | |
2. Выдает список свидетельств где нет программ | |
select | |
_id, | |
`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 | |
where `Total` = 0 | |
order by _id |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment