Hi, [b] i was struggling how to get the count of users from jan 08 to july 08, i have a users_trackers table with column names id, user_id and updated_at with different users and data from jan 08 till date.[/b] i was using rails count method like this : [code] @users_count = UserTracker.count(:all, :conditions => ["updated_at BETWEEN ? and ?", 7.months.ago.to_date, Date.today], :group => "DATE_FORMAT(updated_at, ''%b %Y'')", :order => :updated_at) getting output like this : [["Feb 2008", 1], ["Mar 2008", 16], ["Apr 2008", 35], ["May 2008", 38], ["Jun 2008", 19], ["Jul 2008", 9]] in the above output i was getting the total sum of users existing i.e the users are repeated daily and getting the sum of those too i should get the output like this [["Feb 2008", 1], ["Mar 2008", 3], ["Apr 2008", 5], ["May 2008", 5], ["Jun 2008", 10], ["Jul 2008", 15]][/code] should get only count of users that were there in that month if repeated too Say user_id 1 repeated for 2008-07-06,2008-07-07, 2008-07-08 should get count = 1 and not 3 any 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 -~----------~----~----~----~------~----~------~--~---