Last active
September 8, 2016 06:30
-
-
Save dmitrybubyakin/02f0a42ef2335ad7a15ad766fcfd5547 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
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 or tmp.RegNumber = 'Empty') | |
ORDER BY `tmp`.`certificate_id` ASC | |
SELECT cs.certificate_id AS `CertificateId`,cs.certificateId as `CertificateGuid` , cs._id AS `SupplementId` , | |
( SELECT COUNT( * ) FROM `accreditedprogramm` WHERE `certificatesupplement_id` = cs._id ) AS `spCount` | |
FROM `certificatesupplement` cs | |
where (cs.certificate_id = 6052 or cs.certificateId = 'guid') | |
ORDER BY `CertificateId` ASC |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment