Having trouble with the below query:
- I have a
surveystable - The
surveystable has a foreign key to acontact(viacontact_id) - There are mutiple
surveyspercontact - The
surveyhas a column calledscheduled_atwith time data
I want a query off Surveys with one instance per contact, where that survey has the recent most scheduled_at compared to other instances with the same contact foreign key.
While this seems like a good SQL answer, wondering if there is a cleaner ActiveRecord solution?