the_b1ackfox

asked on

# SQL Calculating The best salesman of the day

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

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

membership

This solution is only available to members.

To access this solution, you must be a member of Experts Exchange.

SOLUTION

membership

This solution is only available to members.

To access this solution, you must be a member of Experts Exchange.

SOLUTION

membership

This solution is only available to members.

To access this solution, you must be a member of Experts Exchange.

SOLUTION

membership

This solution is only available to members.

To access this solution, you must be a member of Experts Exchange.

ASKER

Thank you all for the help with this question. I actually learned alot from the examples posted. Sorry for the delay in getting back on this. I have been away due to family issues

ASKER

Fox