我尝试比较变量@ecart是一个子查询的结果。
我尝试在DECIMAL中转换我的变量,但这没有任何改变。
SET @ecart := 0;
SELECT CASE @ecart := (TIME_TO_SEC(t.temps) - TIME_TO_SEC((
SELECT MIN(t.temps) as Temps
FROM temps t
INNER JOIN inscription i ON t.ide_inscription = i.id AND i.ide_calendrier = 3
INNER JOIN type_temps tt ON tt.id = t.ide_type_temps AND tt.intitule = 'Temps Final')))
WHEN @ecart = 0 THEN ""
WHEN @ecart<60 THEN CONCAT('+',@ecart)
WHEN @ecart BETWEEN 60 AND 3600 THEN CONCAT('+',SEC_TO_TIME(@ecart))
ELSE CONCAT('++',@ecart)
END as Ecart
FROM dag_evenement.temps t
INNER JOIN dag_evenement.inscription i ON t.ide_inscription = i.id AND i.ide_calendrier = 3
INNER JOIN dag_evenement.type_temps tt ON tt.id = t.ide_type_temps AND tt.intitule = 'Temps Final'
INNER JOIN dag_ticketing2.personne p ON i.ide_personne = p.IDPersonne
ORDER BY t.temps ASC;
,结果是
+0
++15
++58
++125
++141
++157
++209
++226
++240
++271
++283
++288
++290
++296
++298
感谢您的帮助!