Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Select Records

Status
Not open for further replies.

Rjconrep

Technical User
Oct 24, 2000
66
0
0
US
I have a table that has 17 sales representatives (over 15,000 records). How can take 20 records from each Sales Rep and put them into 17 different tables?
 
I work for a print house and our client wants to see sample data for each sales rep within the file. 20 records of each to be exact. We use the data to create print proofs.
 
Why not just write a query? Or a report? Or make a form based on your Sales person table, with a subform showing 20 records for each? Is this something you have to do one time? or any time they want it? What's a "print proof"?

Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244. Basics at
 
I am trying to get information on how best to right a query that would produce a table with 20 of each sales rep in it from another table.
 
Again, why do you need to create another table?

You want to return 20 records for EACH sales rep? The top 20 for each on sales amount? How do you want to determine the 20?

You have a table right now that contains records...one of the fields is SalesRepID? Are there any other fields that you'll need?

It's a lot more helpful if you will provide some basic information:
[tt]
I have a table that looks like this with this data:
tblName and ID is the Primary Key
ID SalesRep Otherfield1 Otherfield2
data data data data
data data data data
data data data data
data data data data

I need to return 20 records for each sales rep. I want the
latest by date?
most by sales amount?
some other criteria?

I need the results to look like this:
SalesRep OtherField1 OtherField2
data data data
data data data
data data data
data data data[/tt]

Being able to see a "picture" of what you have and what you want is more helpful.

Thanks,


Leslie

Essential for database developers:
The Fundamentals of Relational Database Design
Understanding SQL Joins
 
This is what my table looks like now:
Contact Name OtherField1 OtherField2
Rhonda Adcox data data
Donna Miller data data
Chuck Adcox data data
Linda True data data


This is what I have written so far and it works but I want a query that will pull 20 records of each Contact. Right now it only pulls 5 records of one contact, "William J. LaBarge".

INSERT INTO Resource
SELECT TOP 5 *
FROM [TRF Final]
WHERE ((([TRF Final].[VGI Contact Name])="Rhonda Adcox"));


I need the results to look like this:
Contact Name OtherField1 OtherField2
Rhonda Adcox data data
Rhonda Adcox data data
Rhonda Adcox data data
Rhonda Adcox data data
Rhonda Adcox data data
Donna Miller data data
Donna Miller data data
Donna Miller data data
Donna Miller data data
Donna Miller data data
Chuck Adcox data data
Chuck Adcox data data
Chuck Adcox data data
Chuck Adcox data data
Chuck Adcox data data
Linda True data data
Linda True data data
Linda True data data
Linda True data data
Linda True data data
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top