Yeah, mostly you need to run 2 queries.
Or if you want it as a report for multiple weeks, you can group by week.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I want to query my past week record compare to my current week record. My database store the data by day.
To get current week record i could simply query it with startOfWeek and endOfWeek to calculate the total_count.
For example, i want to get the record from past week vs current week. I have a column person_count which i will sum it for this week compare to sum of person_count in past week.
How could i achieve this? Or i need to write 2 query to achieve this?
Please or to participate in this conversation.