Hey All,
It's been a while...
I'm looking to go through a table of sales which has a reference to the sales person for that sale. There is another table with details of the sales person.
What I need to do is add up the amount of sales each person did (amount of individual sales not value of sales) then select the top 10 sales people and display their names. Any ideas. I'll do a basic structure of the tables below:
----------------------
|Sales Table |
----------------------
id | sale desc|saleperson
--------------------------
1 | Sale1 |person1
2 | Sale2 |person2
3 | Sale3 |person1
-----------------------
| Sales People |
------------------------
1 | Joe | Smith
2 | Bob | Rogers
Result:
1 Joe Smith with 2 sales
2 Bob Rogers with 1 sale
Reality is built on a foundation of dreams.
It's been a while...
I'm looking to go through a table of sales which has a reference to the sales person for that sale. There is another table with details of the sales person.
What I need to do is add up the amount of sales each person did (amount of individual sales not value of sales) then select the top 10 sales people and display their names. Any ideas. I'll do a basic structure of the tables below:
----------------------
|Sales Table |
----------------------
id | sale desc|saleperson
--------------------------
1 | Sale1 |person1
2 | Sale2 |person2
3 | Sale3 |person1
-----------------------
| Sales People |
------------------------
1 | Joe | Smith
2 | Bob | Rogers
Result:
1 Joe Smith with 2 sales
2 Bob Rogers with 1 sale
Reality is built on a foundation of dreams.