I have a query like this.
SELECT IFNULL(SUM(price),0) as total FROM table1
WHERE table1.id= 33 AND start_time BETWEEN '2019-09-1' AND '2019-09-11'
This works fine. Now I want to SUM
the data of a month so I tried to use the between
feature and get first day and last day of the month.
SELECT IFNULL(SUM(price),0) as total FROM table1
WHERE table1.id = 33 AND start_time BETWEEN (SELECT DATEADD(month, DATEDIFF(month,
'2019-09-15'), 0) AND '2019-09-11'
I used this ref