Skip to content

Commit

Permalink
fix: correct ORDER BY clause for date filtering query [#5]
Browse files Browse the repository at this point in the history
The original ORDER BY included a field that was not present in the GROUP BY clause or any aggregate function
  • Loading branch information
chiqui3d committed Apr 17, 2023
1 parent 93ec4ca commit a663670
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ public function getAll(): array
->createQueryBuilder('m')
->select('YEAR(m.createdAt) as year', 'MONTH(m.createdAt) as month', 'count(m) as count')
->groupBy('year', 'month')
->orderBy('m.createdAt', 'ASC')
->orderBy('year', 'ASC')
->addOrderBy('month', 'ASC')
->getQuery()
->getResult();
}
Expand Down

0 comments on commit a663670

Please sign in to comment.