On 30 Apr 2008, at 00:59, Trevor Squires wrote:

>
> On 4/29/08, Frederick Cheung <[EMAIL PROTECTED]> wrote:
>> Yeah, ugh. If we grouped by post_id are we guaranteed anything
>> sensible (I seem to remember that what the db gives for non agregate,
>> not grouped on columns can't be relied upon to be anything specific
>> other than one of the rows but I can't remember).
>>
>
> The main hurdle I found with trying to use "group by" is that any
> "order by" in your query is applied *after* the grouping so you can't
> use "group by" to try and simulate "distinct on".
Ah yes, of course. (the only way round that i know of is to order in a  
subselect and then select from that and group, but then we're back in  
the realm of fugliness).

Fred
>
>
> If anyone with some cross-database smarts wants to chime in with the
> ultimate solution I'd love to see it.  It's a rare use-case but it
> seriously bugs me that I can't find a good, cheap, cross-database
> solution :-P
>
> Trev
>
> -- 
> --
> Trevor Squires
> http://somethinglearned.com
>
> >


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to