ran into a bit of an issue today.
Basically, I need to select a certain range of dates after I have already completed the query SELECT * FROM <DB>
.
For example:
var (date string
views int
impressions int)
for query.Next() {
err := query.Scan(&date, &views, &impressions)
// handle the err
// get the range of dates for each month
// add up all the views and impressions in that specific range
}
The 'date' var will obviously be all of the dates in the database query.
Dates are formatted as: 2017-10-01
(October 1st as an example) and there are about 300 in October and 100 in November.
Basically from here, I need to add up all the values (views and impressions), but only per date range.
So I would get something like:
2017-10-01
to 2017-10-31
has 54
impressions2017-10-01
to 2017-10-07
has 5
impressions as an example.
Any idea how I'd come about this issue?
Hope I explained this alright and thanks in advanced.