I am trying to make a stats script, that groups by date and and unique_id, to see what if users have visit before
My database exampel:
2015-05-01 - 123
2015-05-01 - 123
2015-05-01 - 000
== 2015-05-01 is the date and uniques is 2
2015-05-02 - 123
2015-05-02 - 123
2015-05-02 - 123
== 2015-05-02 is the date and uniques is 1
My code is this:
$get_unique = $this->modelsManager->createBuilder()
->columns(array('COUNT(*) as cnt', 'Statistics.date', 'Statistics.unique_id'))
->from('Statistics')
->groupBy(array('Statistics.date, Statistics.unique_id'))
->distinct('Statistics.unique_id')
->betweenWhere('Statistics.date', $from_date, $to_date)
->getQuery()
->execute();
Hope you understand and can help me out! Thanks!