On Feb 15, 6:59 am, Peter <ppgeng...@prevailhs.com> wrote: > And you can actually represent this in AR friendly syntax; no console > in front of me but its something like > > Player.find(:select => "players.id", :joins => :trophies, :group => > 'players.id', :having => 'count(players.id) > 5') > > Downside of this is that the returned objects in this case would only > have ID attribute; you can add more to the select, but you need to add > them to the :group as well. Would be nice if there was a better way > to do this; SQL requires them in both the select and group_by, but > it'd be nice if rails would auto do that for the table I'm doing the > find on by default.
Depends on the database - mysql doesn't care what you add to the select. Fred -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.