two records for same value cell

  • Thread starter Thread starter regigirl
  • Start date Start date
R

regigirl

I have a data base that has several transactions for several employee id
numbers. I am trying to figure out how to get 2 random transactions for each
employee. I have no clue how to do this or if it can be done.
 
Post the table structure (i.e. table & field names involved). Is this all in
one table, or is there an employee table and a transaction table that
contains the related employeeID with each transaction?

There is a Rnd() function that will generate random numbers; however,
without knowing something of the table structure, it will be difficult to
answer more specifically.
 
I have a data base that has several transactions for several employee id
numbers. I am trying to figure out how to get 2 random transactions for each
employee. I have no clue how to do this or if it can be done.

Answered in microsoft.public.access. Please don't multipost, it wastes the
time of volunteers who respond even to posts which have been answered
elsewhere.
 
Try this --
SELECT [tblTransaction].[EmployeeID], (SELECT TOP 2 [Transactions] FROM
[tblTransaction] AS [XX] WHERE [XX].[EmployeeID] =
[tblTransaction].[EmployeeID] ORDER BY Right(Left(Rnd([EmployeeID]), 4),1))
AS [Sample]
FROM [tblTransaction];

--
Disclaimer: This author may have received products and services, free, at or
below market price, mentioned in this post at or below cost equal to that of
consumer. Mention and/or description of a product or service herein does not
constitute endorsement thereof. Any code or psuedocode included in this post
is offered "as is", with no guarantee as to suitability or functionality. You
can thank the FTC of the USA for making this disclaimer possible/necessary.
 
Ok, so i guess i should have been a little more clear. i'm a little new to access so simple with explinations on the responses would be most helpful.

The table is actually the result of a query.
the query is named agent transactions and pulls several columns

date
location
employee id
employee name
customer phone#
code
credit amount

I am trying to pull randomly two records for each employee id (there are about 4000 employee ids and roughly 50,000 transactions).
I tried the solution above, but i don't really understand SQl unless it's explained a little.

(oh yeah, and I won't post in that other forum for those wonderful people who help me :)

Thanks everyone!
 
I'm sorry I've never done this before. So I tried to do what you had said in the other forum, but I think it may be a little advanced for me to figure out. I was able to get the sheet to shuffle by random number and i created the module, but i have no idea how to connect or use either of them. i've never worked with modules. only queries. Here's a little additional informtion.
The table is actually the result of a query.
the query is named agent transactions and pulls several columns

date
location
employee id
employee name
customer phone#
code
credit amount


If you could tell me specifically what i need to do that would help a lot.
 
Back
Top