Hey all, i create a hash from an description field to find equal entries. Now i want to show only the entries with an equal hash. (Hash value is stored in text_hash field on the model) I try :group => ''text_hash'' but i dont figure out the where condition. (Where Count(*) > 2 something like this... ) Can this be done with minimum? Thanks for help :) -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I think i have a solution: :group => "text_hash having count(text_hash) > 2 but how to :order, :order => ''text_hash DESC'' seems not to work :-/ Perhaps i have to sort the result collection... Stephan Meier wrote:> Hey all, > > i create a hash from an description field to find equal entries. > Now i want to show only the entries with an equal hash. > (Hash value is stored in text_hash field on the model) > > I try :group => ''text_hash'' but i dont figure out the where condition. > (Where Count(*) > 2 something like this... ) > > Can this be done with minimum? > > Thanks for help :)-- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 16 Feb 2009, at 16:52, Stephan Meier wrote:> > Hey all, > > i create a hash from an description field to find equal entries. > Now i want to show only the entries with an equal hash. > (Hash value is stored in text_hash field on the model) > > I try :group => ''text_hash'' but i dont figure out the where condition. > (Where Count(*) > 2 something like this... ) > > Can this be done with minimum?you need a ''having'' clause to filter on an aggregate function such as count. rails 2.3 allows you to pass :having => ''...'' with old versions you need to do mucky stuff like :group => ''text_hash having something >2'' Fred> > > Thanks for help :) > -- > Posted via http://www.ruby-forum.com/. > > >--~--~---------~--~----~------------~-------~--~----~ 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-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
You need to clean up your question. It makes no sense. Please be clearer if you want a response. Blog: http://random8.zenunit.com/ Learn rails: http://sensei.zenunit.com/ On 17/02/2009, at 3:52 AM, Stephan Meier <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org > wrote:> > Hey all, > > i create a hash from an description field to find equal entries. > Now i want to show only the entries with an equal hash. > (Hash value is stored in text_hash field on the model) > > I try :group => ''text_hash'' but i dont figure out the where condition. > (Where Count(*) > 2 something like this... ) > > Can this be done with minimum? > > Thanks for help :) > -- > Posted via http://www.ruby-forum.com/. > > >--~--~---------~--~----~------------~-------~--~----~ 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-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---