I have a query that needs to be run for each day of the month, is there a way I can run a single query so that I don't have to change the date in the query for each time I run it. I have tried using the While loop but it doesn't give me any answers. When I run the code below it shows error 1064
set @StartDate1 = '2020-07-01';
set @EndDate = '2020-07-30';
WHILE (@StartDate1 < @EndDate) DO
SELECT COUNT(id ), json_extract(data , '$.metadata.referred')
FROM modulusDb mdb
where json_extract(data , '$.event') = 'install' and json_extract(data , '$.metadata.referred') = TRUE
and created_at >= @StartDate1 and created_at < DATEADD(day, 1, @StartDate1)
SET @StartDate1 = DATEADD(day, 1, @StartDate1)
END WHILE