I'll leave the solution I found here in case it's useful to anyone:
.left_join(DB[:events].select{[user_id,
min(start_time).as(min_start)]}.where(active: true).group(:user_id),
user_id: :id)
.left_join('events', 't1.user_id = e2.user_id AND t1.min_start =
e2.start_time', {table_alias: 'e2'})
--
You received this message because you are subscribed to the Google Groups
"sequel-talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
Visit this group at http://groups.google.com/group/sequel-talk?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.