Having trouble with the below query:
- I have a
surveys
table - The
surveys
table has a foreign key to acontact
(viacontact_id
) - There are mutiple
surveys
percontact
- The
survey
has a column calledscheduled_at
with 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?