Hi,
My data set looks like:
id type date count
1 dogs 2010-01-01 1
1 dogs 2010-01-15 4
1 dogs 2010-01-31 10
1 cats 2010-02-02 4
1 cats 2010-02-16 7
What I want to do is write a query that will return the record that contains the max(date) for a given type AND sum up all the counts for a given type.
So I'd like my result set to be:
1 dogs 2010-01-31 15 (which is 1+4+10)
1 cats 2010-02-16 11 (which is 4+7)
What is the most efficient way to do this?
Thanks much
My data set looks like:
id type date count
1 dogs 2010-01-01 1
1 dogs 2010-01-15 4
1 dogs 2010-01-31 10
1 cats 2010-02-02 4
1 cats 2010-02-16 7
What I want to do is write a query that will return the record that contains the max(date) for a given type AND sum up all the counts for a given type.
So I'd like my result set to be:
1 dogs 2010-01-31 15 (which is 1+4+10)
1 cats 2010-02-16 11 (which is 4+7)
What is the most efficient way to do this?
Thanks much