Last active
August 29, 2015 14:21
-
-
Save alborq/4c9487a3c593da686384 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 | |
* | |
FROM AppliControle AS ac | |
INNER JOIN applicontrole_controlinterne AS aci ON aci.applicontrole_id = ac.id | |
INNER JOIN ControlInterne AS ci ON aci.controlinterne_id = ci.id | |
INNER JOIN Task AS t ON ci.task_id = t.id | |
INNER JOIN ( | |
SELECT | |
aci2.applicontrole_id AS id, | |
max(t2.date) as recent | |
FROM Task as t2 | |
INNER JOIN ControlInterne AS ci2 ON ci2.task_id = t2.id | |
INNER JOIN applicontrole_controlinterne AS aci2 ON aci2.controlinterne_id = ci2.id | |
GROUP BY (aci2.applicontrole_id) | |
) as tRecent ON tRecent.id = ac.id AND tRecent.recent = t.date; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment