Duplicate Records in Query

  • Thread starter Thread starter gumby
  • Start date Start date
G

gumby

I have five names

David
Joe
Smith
Hank
Jim

I want the query to return.
David
David
Joe
Joe
Smith
Smith
Hank
Hank
Jim
Jim

Thanks,
David
 
I don't understand.

While I do see that there are two of each, the order of the names is
different between starting condition and ending condition... and the ending
names are not sorted alphabetically.

How did you come up with the sort order? Will you always only want 2 of
each? Could it be three?

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
I don't understand.

While I do see that there are two of each, the order of the names is
different between starting condition and ending condition... and the ending
names are not sorted alphabetically.

How did you come up with the sort order? Will you always only want 2 of
each? Could it be three?

Regards

Jeff Boyce
Microsoft Office/Access MVP







- Show quoted text -

I have five names, I want to assign a random number to each. However I
want to assign two random numbers. So I thought if I duplicated the
names in a query I could do that. The sort order has nothing to do
with it. Just the way I typed it.
 
I have five names

David
Joe
Smith
Hank
Jim

I want the query to return.
David
David
Joe
Joe
Smith
Smith
Hank
Hank
Jim
Jim

Thanks,
David
SELECT MyNames.first_name, "Original" AS [Is What]
FROM MyNames
UNION ALL SELECT MyNames.first_name, "Duplicate" AS [Is What]
FROM MyNames
ORDER BY MyNames.first_name;

first_name Is What
David Duplicate
David Original
Hank Duplicate
Hank Original
Jim Duplicate
Jim Original
Joe Duplicate
Joe Original
Smith Duplicate
Smith Original
 
Create a query. Add the table. Add the name field.

Add a new field:
Random1: Rnd()

Add another new field:
Random2: Rnd()

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
Back
Top