two records for same value cell

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.
 
B

Brian

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.
 
J

John W. Vinson

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.
 
K

KARL DEWEY

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top