because your request is shit

This commit is contained in:
Unknown 2018-03-13 21:59:09 +01:00
parent 4999dcee05
commit 127132f9b2
1 changed files with 29 additions and 36 deletions

View File

@ -193,27 +193,20 @@ class ue extends Repo_i {
FROM UE ue
LEFT JOIN Formation fdef ON ue.Formation_idFormation = fdef.idFormation
LEFT JOIN (
SELECT ue2.code code, CONCAT('[',GROUP_CONCAT(fform.idFormation), ']') formations
FROM UE ue2, Formation fform
WHERE ( fform.idFormation IN (
SELECT DISTINCT Formation_idFormation as idForm
FROM GroupeCours
WHERE Cours_idCours IN ( SELECT idCours FROM Cours WHERE UE_code = ue2.code GROUP BY idForm )
)
OR fform.idFormation IN (
SELECT DISTINCT Formation_idFormation as idForm
FROM GroupeTD
WHERE TD_idTD IN ( SELECT idTD FROM TD WHERE UE_code = ue2.code GROUP BY idForm )
)
OR fform.idFormation IN (
SELECT DISTINCT Formation_idFormation as idForm
FROM GroupeTP
WHERE TP_idTP IN ( SELECT idTP FROM TP WHERE UE_code = ue2.code GROUP BY idForm )
)
)
SELECT ue2.code code, CONCAT('[',GROUP_CONCAT(DISTINCT Formation.idFormation), ']') formations
FROM UE ue2
LEFT JOIN Cours C ON ue2.code = C.UE_code
LEFT JOIN TD T ON ue2.code = T.UE_code
LEFT JOIN TP T2 ON ue2.code = T2.UE_code
LEFT JOIN GroupeCours C2 ON C.idCours = C2.Cours_idCours
LEFT JOIN GroupeTD TD2 ON T.idTD = TD2.TD_idTD
LEFT JOIN GroupeTP TP2 ON T2.idTP = TP2.TP_idTP
JOIN Formation ON C2.Formation_idFormation = Formation.idFormation
OR TD2.Formation_idFormation = Formation.idFormation
OR TP2.Formation_idFormation = Formation.idFormation
GROUP BY `ue2`.`code`
) formlist ON formlist.code = ue.code
$cond
##$cond
GROUP BY `ue`.`code`
ORDER BY `ue`.`label` ASC");