PC Review


Reply
Thread Tools Rate Thread

How can I get the top x number of values for each person?

 
 
=?Utf-8?B?Um9iIFJoYXRpZ2Fu?=
Guest
Posts: n/a
 
      27th Feb 2006
I have a table displaying sales people, their clients(each person could have
any number of clients), and the amount $$ each client bought from the sales
person. I am trying to design a query to display the top 3 or 5 clients
according to $$ for each sales person.

Any Thoughts?

-Rob
 
Reply With Quote
 
 
 
 
=?Utf-8?B?T2Zlcg==?=
Guest
Posts: n/a
 
      27th Feb 2006
In the query try something like

SELECT [M1].[sales person], [M1].[ClientName]
FROM [Sales Table] AS M1
WHERE M1.[ClientName] In (SELECT Top 5 M2.[ClientName]
FROM [Sales Table] as M2
WHERE M2.[sales person] =M1.[sales person]
ORDER BY M2.[Amount] Desc)


--
\\// Live Long and Prosper \\//
BS"D


"Rob Rhatigan" wrote:

> I have a table displaying sales people, their clients(each person could have
> any number of clients), and the amount $$ each client bought from the sales
> person. I am trying to design a query to display the top 3 or 5 clients
> according to $$ for each sales person.
>
> Any Thoughts?
>
> -Rob

 
Reply With Quote
 
Joseph Meehan
Guest
Posts: n/a
 
      28th Feb 2006
Rob Rhatigan wrote:
>I have a table displaying sales people, their clients(each person
> could have any number of clients), and the amount $$ each client
> bought from the sales person. I am trying to design a query to
> display the top 3 or 5 clients according to $$ for each sales person.
>
> Any Thoughts?


Maybe normalize the table structure? Normally if you have sales people
with clients (more than one) you would split that up into two tables one for
sales people and one for clients linked to the sales people. I might add
that you may well want to have a third table for sales. Is it possible that
one client may have sales from more than one sales person? What happens if
a sales person leaves?

>
> -Rob


--
Joseph Meehan

Dia duit


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to calculate the number of person littleskinny83@gmail.com Microsoft Access Queries 5 13th May 2008 02:30 AM
Counting the number of events a person attended =?Utf-8?B?RmlhY2hyYQ==?= Microsoft Access Queries 4 9th Jun 2006 10:53 AM
person number f_ringberg@hotmail.com Microsoft Excel Discussion 5 23rd Feb 2006 02:51 AM
How to Total YTD Income and Commission Per Person From Values at Adjacent Columns? (Tables Fixed Hopefully) Sarah Anderson Microsoft Excel Misc 6 19th May 2004 09:19 PM
Re: How can I find a person from a phone number or email address ? Sue Mosher [MVP] Microsoft Outlook Contacts 0 4th Sep 2003 02:52 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:11 PM.