2013-10-24

I have data like this:

I want to sort the data by the DateReceived and sum the Quantity. BUT, I want to sum the Quantity grouped by the VendorID as long as they are adjacent like the example output below.

I currently am doing this by loading all rows and going through them in my application code. This is currently a bottleneck in my software that I would like to elimiate.

What is a MS Sql Server query to generate the desired output?

PS. Any suggestions for a better title?

Show more