I have a weekly view of projects. For each project I’m grabbing the first record for each day of the week. It’s important to me to always get the first record for that day, and know which weekdays have no records. Right now I’m doing this with a separate SQL string for each project + day of week combo in a nested for loop.
This feels wrong. It seems like I should be able to get this with ActiveRecord / SQL via Group By and Limit, and use Ruby/Rails to process the results. Is this possible?
Thanks in advance.
– David
Does that do the job? (Using MySQL)
Take a look at DATEOFWEEK() in MySQL docs
You can test with