-
-
Save sethdorris/87091df16414c94a30398dc3184df683 to your computer and use it in GitHub Desktop.
This file contains 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
WITH cts AS (SELECT COUNT(Id) as UniqueCount, MIN(Triggers.Id) as LowestTriggerId | |
FROM Triggers | |
GROUP BY DeviceId, AccelerationPeakMagnitude_G, PeakOverPressure_Psi) | |
SELECT COUNT(cts.UniqueCount) AS UniqueTriggers FROM cts | |
WITH cte AS (SELECT MIN(Triggers.Id) as LowestTriggerId | |
FROM Triggers | |
GROUP BY DeviceId, AccelerationPeakMagnitude_G, PeakOverPressure_Psi) | |
SELECT Count(*) FROM (SELECT COUNT(*) AS theCounts FROM cte | |
left JOIN PressureData ON cte.LowestTriggerId = PressureData.TriggerId | |
GROUP BY PressureData.TriggerId) AS outercount |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment