Torna al Thread
SELECT
.creazione
.chiusura
if (evento = 'VERDE' , 5 , (if (evento = 'ROSSO' , 7 , ( if (evento = 'GIALLO' , 0 ) ) )) ) AS LimiteTemporale
DATEDIFF(chiusura,creazione) AS DAYDIFF,
if(datediff(chiusura,creazione)<= LimiteTemporale, 'InTime', 'OutTime') AS InOut