troubleshooting Question

SQL Calculating The best salesman of the day

Avatar of the_b1ackfox
the_b1ackfoxFlag for United States of America asked on
Microsoft SQL ServerMicrosoft SQL Server 2008Microsoft SQL Server 2005
6 Comments4 Solutions460 ViewsLast Modified:
Hello Experts,

I have a table that contains information as follows:

SalesID, NumbSales, SalesDate

So: if salesman X sells 23 widgets on thursday, 30 widgets on friday, and 50 on Saturday
if salesman Y sell 14 widgets on Thursday, 33 widgets on friday and 42 widgets on saturday

my table looks like this:
rwid   SalesID   NumbSales   SalesDate

10   | 1         | 23              | '2012-07-06'|
11   | 2         | 14              | '2012-07-06'|
12   | 1         | 30              | '2012-07-07'|
13   | 2         | 33              | '2012-07-07'|
14   | 1         | 50              | '2012-07-08'|
15   | 2         | 42              | '2012-07-08'|


How can I get the salesmans ID who had the max sales for the day?

So I get:

10   | 1         | 23              | '2012-07-06'|
13   | 2         | 33              | '2012-07-07'|
14   | 1         | 50              | '2012-07-08'|

Thank you in advance!

-Fox
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 4 Answers and 6 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 4 Answers and 6 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros