Problème Case en SQL

Fermé
fredoalex - 20 févr. 2018 à 09:59
yg_be Messages postés 22724 Date d'inscription lundi 9 juin 2008 Statut Contributeur Dernière intervention 25 avril 2024 - 20 févr. 2018 à 18:55
Bonjour,

Mon code ci dessous ne fonctionne pas et je ne comprend pas pourquoi

With ma1(
SELECT distinct "cmenucom", "cmedatc","grplib", "cmedatl1", "cmedatarr_ph", "blenum", "bledatl", ( "bledatl" - "cmedatarr_ph" ) "nbj_retard", ( "cmedatl1" - "cmedatarr_ph" ) "delai" FROM "fac_coment" LEFT JOIN "fac_bldet" ON "bldretab" = "cmeetab" AND "bldrnum" = "cmenucom" LEFT JOIN "fac_blent" ON "bldetab" = "bleetab" AND "bldnum" = "blenum"
left join "fac_groupe_ent" on "grplib"="grplib"
WHERE "bledatl" >= '2018.01.01'

)

Select *
case
when delai<=2 then Nbj_retard-1
else nbj_retard
end
from ma2


1 réponse

yg_be Messages postés 22724 Date d'inscription lundi 9 juin 2008 Statut Contributeur Dernière intervention 25 avril 2024 1 476
20 févr. 2018 à 18:55
bonsoir, "ne fonctionne pas": message d'erreur, résultat inattendu, ?
0