Last active
February 18, 2022 10:40
-
-
Save James-McNeill/66cb175fa5abf04790a9a3d24edd9e8d 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
-- Declare your variables | |
DECLARE @start date | |
DECLARE @stop date | |
-- SET the relevant values for each variable | |
SET @start = '2021-06-01' | |
SET @stop = GETDATE() | |
-- Run select statement | |
SELECT t1.[DATETIME], COUNT(*) AS vol | |
FROM Medium.dbo.Earthquakes t1 | |
WHERE t1.[DATETIME] BETWEEN @start AND DATEADD(MONTH, -3, @stop) | |
GROUP BY t1.[DATETIME] | |
ORDER BY t1.[DATETIME] DESC; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment