I made a little progress:

      .left_join(DB[:events].select{[user_id, 
min(start_time)]}.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'})

The remaining problem is that I can't figure out how to alias 
min(start_time) to min_start. But if I rename t1.min_start to 
t1.start_time, the column is not found.

I'm stymied at this point. Does min(start_time) return the column? If so, 
what is it named? Or, how do you alias min(start_time)?


-- 
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.


Reply via email to