Follow along with the video below to see how to install our site as a web app on your home screen.
Anmerkung: This feature currently requires accessing the site using the built-in Safari browser.
Declare @FromDate Date = '2021-01-01',
@ToDate Date = '2021-03-25'
;WITH cnt (Date) AS
(
SELECT @FromDate
UNION ALL
SELECT DATEADD(day, 1, Date)
FROM cnt
WHERE Date < @ToDate
), cte As
(
SELECT mrID, Min(mrTimestamp) As MinStamp, Max(mrTimeStamp) As MaxStamp
FROM footprints.dbo.MASTER8_FIELDHISTORY GROUP BY mrID
)
SELECT cte.mrID, cnt.Date, cte.MinStamp, cte.MaxStamp,
(
SELECT TOP 1 T1.mrNewFieldValue
FROM footprints.dbo.MASTER8_FIELDHISTORY T1
WHERE T1.mrID = cte.mrID AND T1.mrTimeStamp <= cnt.Date
ORDER BY T1.mrTimeStamp DESC
)
As mrNewFieldValue
FROM cte LEFT OUTER JOIN cnt
ON cnt.Date BETWEEN cte.MinStamp AND cte.MaxStamp
OPTION (MAXRECURSION 0) -- remove limit
Sorry für die späte Antwort.MSSQL kann definitiv rekursive CTE's.
Kommt jetzt nur noch drauf an, es herauszufinden wie es geht (Bin kein MSSQL-Experte)
Mal schauen ob @Yaslaw den Thread findet