Db-why-not
Registered User.
- Local time
- Today, 10:07
- Joined
- Sep 17, 2019
- Messages
- 159
Hello,
I am assigning random records for auditing to a team of people who updated the records. I have the file that shows what records everyone updated and who updated the record. I created a query (Generate_random) to assign a randomID number to each record that was updated.
SELECT FixedRecords.ien1, FixedRecords.ien2, FixedRecords.Name, Rnd([IEN1]) AS RandomID
FROM FixedRecords;
I am trying to pull random records from this query to make a table so it will automatically give me table with 10 random records that each person updated. Then I can assign 10 records to each team member to audit. There is a name Field it shows the names of people who updated the record, then there is a RandomID field. I am trying to write a query that will pull up the top 10 records for each Name. I want it to use the RandomID field to find the top 10 records. I need 10 records that were completed by each person in the name field.
Example:
Name: Sally, RandomID: 24545
Name: Sally, RandomID: 24445
Name: Sally, RandomID: 23545
"" Top 10 records with sally
Name: Mary, RandomID: 54545
Name: Mary, RandomID: 44545
"" top 10 records with Mary
Name: roger, RandomID: 14545
Name: roger, RandomID: 12545
"" Top 10 records with roger
How would I write this second query to pull this data. I was going to have it make a table because once the table is made I dont want the RandomID to keep changing anymore.
When I use this SQL code it only gives me 10 records. I want 10 records from each unique Name Field
SELECT TOP 10 Generate_random.RandomID, Generate_random.Name
FROM Generate_random
GROUP BY Generate_random.RandomID, Generate_random.Name
ORDER BY Generate_random.RandomID;
How would I rewrite this SQL to give me what I need? Thank you
I am assigning random records for auditing to a team of people who updated the records. I have the file that shows what records everyone updated and who updated the record. I created a query (Generate_random) to assign a randomID number to each record that was updated.
SELECT FixedRecords.ien1, FixedRecords.ien2, FixedRecords.Name, Rnd([IEN1]) AS RandomID
FROM FixedRecords;
I am trying to pull random records from this query to make a table so it will automatically give me table with 10 random records that each person updated. Then I can assign 10 records to each team member to audit. There is a name Field it shows the names of people who updated the record, then there is a RandomID field. I am trying to write a query that will pull up the top 10 records for each Name. I want it to use the RandomID field to find the top 10 records. I need 10 records that were completed by each person in the name field.
Example:
Name: Sally, RandomID: 24545
Name: Sally, RandomID: 24445
Name: Sally, RandomID: 23545
"" Top 10 records with sally
Name: Mary, RandomID: 54545
Name: Mary, RandomID: 44545
"" top 10 records with Mary
Name: roger, RandomID: 14545
Name: roger, RandomID: 12545
"" Top 10 records with roger
How would I write this second query to pull this data. I was going to have it make a table because once the table is made I dont want the RandomID to keep changing anymore.
When I use this SQL code it only gives me 10 records. I want 10 records from each unique Name Field
SELECT TOP 10 Generate_random.RandomID, Generate_random.Name
FROM Generate_random
GROUP BY Generate_random.RandomID, Generate_random.Name
ORDER BY Generate_random.RandomID;
How would I rewrite this SQL to give me what I need? Thank you