Created
September 12, 2024 15:41
-
-
Save luisdelatorre012/55bcb8fbc60a36a94c919666d8ba6ead to your computer and use it in GitHub Desktop.
cross apply
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
t.Category, | |
MIN(j.eventRecordedTime) AS MinEventTime, | |
MAX(j.eventRecordedTime) AS MaxEventTime, | |
AVG(j.someNumericValue) AS AvgValue | |
FROM | |
t | |
CROSS APPLY OPENJSON(CAST(CAST(t.message AS varchar(max)) AS nvarchar(max))) | |
WITH ( | |
eventRecordedTime datetime2 '$.eventRecordedTime', | |
someNumericValue float '$.someNumericValue' | |
) AS j | |
GROUP BY | |
t.Category |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment