Folge dem Video um zu sehen, wie unsere Website als Web-App auf dem Startbildschirm installiert werden kann.
Anmerkung: Diese Funktion ist in einigen Browsern möglicherweise nicht verfügbar.
SELECT A.KundenID, DATEDIFF( B.`BezDat` , A.`BezDat` ) AS Date_Diff, Min( B.BezDat ) AS BezDat
FROM zero AS A
INNER JOIN zero AS B
ON A.KundenID = B.KundenID
AND A.BezDat < B.BezDat
GROUP BY A.KundenID, A.BezDat
SELECT M.`KundenID` , `last` , DATE_ADD( `last` , INTERVAL `avg` DAY ) AS `next` ,
CASE WHEN DATE_ADD( `last` , INTERVAL `avg` DAY ) < CURRENT_DATE THEN 'true' ELSE 'false' END AS overdue
FROM (
SELECT `KundenID` , MAX( `BezDat` ) AS `last`
FROM `auftrag`
GROUP BY `KundenID`
)M
INNER JOIN (
SELECT `KundenID` , AVG( Date_Diff ) AS `avg`
FROM (
SELECT A.KundenID, DATEDIFF( B.`BezDat` , A.`BezDat` ) AS Date_Diff, Min( B.BezDat ) AS BezDat
FROM auftrag AS A
INNER JOIN auftrag AS B
on A.KundenID = B.KundenID
AND A.BezDat < B.BezDat
AND A.Auftrag='TypeB'
AND A.BezDat IS NOT NULL
GROUP BY A.KundenID, A.BezDat)
AS T
GROUP BY `KundenID`
) AS AT
ON M.`KundenID` = AT.`KundenID`;
SELECT `KundenID` ,
MAX( `BezDat` ) AS `last` ,
DATE_ADD( MAX( `BezDat` ) , INTERVAL AVG( Date_Diff ) DAY ) AS `next` ,
CASE WHEN
DATE_ADD( MAX( `BezDat` ) , INTERVAL DATE_ADD( MAX( `BezDat` ) , INTERVAL AVG( Date_Diff ) DAY ) DAY ) < CURRENT_DATE
THEN 'true'
ELSE 'false'
END AS overdue
FROM (
SELECT A.KundenID, DATEDIFF( B.`BezDat` , A.`BezDat` ) AS Date_Diff, Min( B.BezDat ) AS BezDat
FROM zero AS A
INNER JOIN zero AS B
ON A.KundenID = B.KundenID
AND A.BezDat < B.BezDat
GROUP BY A.KundenID, A.BezDat
) AS T
GROUP BY `KundenID`
SELECT `KundenID` ,
MAX( `BezDat` ) AS `last` ,
DATE_ADD( MAX( `BezDat` ) , INTERVAL AVG( Date_Diff ) DAY ) AS `next` ,
CASE WHEN
DATE_ADD( MAX( `BezDat` ) , INTERVAL AVG( Date_Diff ) DAY ) < CURRENT_DATE
THEN 'true'
ELSE 'false'
END AS overdue
FROM (
SELECT A.KundenID, DATEDIFF( B.`BezDat` , A.`BezDat` ) AS Date_Diff, Min( B.BezDat ) AS BezDat
FROM zero AS A
INNER JOIN zero AS B
ON A.KundenID = B.KundenID
AND A.BezDat < B.BezDat
GROUP BY A.KundenID, A.BezDat
) AS T
GROUP BY `KundenID`