Count unique records with DataMapper
Saturday 01/3/2009 – Category: Uncategorized
dm-aggregates provides an aggregate method that allows for "multiple aggregate functions to be used in a single query, with automatic grouping when :fields is specified"
Hit.aggregate(:ip_address).length
Will yield the number of unique IP addresses in the hits table.
Leave a Reply
Recent Posts
- Marble Paint
(Friday 02/4/2011 – 1 Comment) - More Flickr Original Updates
(Sunday 01/23/2011 – 13 Comments) - Flickr Original updates
(Saturday 08/7/2010 – 19 Comments) - LED Light for iPhone 4
(Monday 06/28/2010 – 65 Comments)
