How to solve mysql daily analytics that happens when date changes
You have to put a date on your data and instead of using now() use it.
I have two separate programs; one counts the daily view stats and another calculates earning based on the stats.
Counter runs first and followed by Earning Calculator a few seconds later.
Earning Calculator works by getting stats from counter table using date(created_at) > date(now()).
The problem I'm facing is that let's say at 23:59:59 Counter added 100 views stats and by the time the Earning Calculator ran it's already the next day.
Since I'm using date(created_at) > date(now()), I will miss out the last 100 views added by the Counter.
One way to solve my problem is to summarise the previous daily report at 00:00:10 every day. But I do not like this.
Is there any other ways to solve this issue?
Thanks.