This is a 2 part problem. I have a sorted query – [Most_FT_3g_v6_Query] that shows the most free throws made for 3 consecutive games. My listing shows many of the same player (i.e. uses 2 of the games that the leader used.) I figured that if I asked for duplicates (players listed for the same season) I would then have a better listing of top 3 game free throws made. But when I make my list of duplicates, it includes the top records. I would expect that the duplicate list would NOT include the top listing, but would include those with the same Roster_ID as shown above. Something tells me that this will involve indexes. I’m not sure how to ‘create’ indexes.43373-Creating-duplicates
My second problem is when the duplicate list is appropriate, how do I remove those records from the ‘original’ query?
![]() |
Patch reliability is unclear. Unless you have an immediate, pressing need to install a specific patch, don't do it. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |
-
Finding duplicates, and removing duplicates
Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Finding duplicates, and removing duplicates
- This topic has 16 replies, 3 voices, and was last updated 9 years, 3 months ago.
AuthorTopicWSjlwood44
AskWoody LoungerJanuary 22, 2016 at 7:49 pm #504159Viewing 13 reply threadsAuthorReplies-
WSDavidHLevin
AskWoody LoungerJanuary 23, 2016 at 3:25 pm #1548545Hi jlwood44,
I’m not sure why you mention “index,” the purpose of which is to allow the database management system to more quickly fetch database rows that match the query criteria. A database would have to be quite large before the overhead of creating an index would be outweighed by the benefit.Also, perhaps you could more clearly explain what you consider “duplicate,” that is, what field(s) you want to essentially be the unique identifier. Would it be player and year, so that there would be only one result for , namely, the result where free throws made over the three games was highest for that combination of player and year? If there were several rows for a given player and year that had the same three-game sum (as for ), which one would you want selected?
It might help also if you provided the query statement(s) you’re using.
Hope this helps,
Dave -
WSjlwood44
AskWoody LoungerJanuary 23, 2016 at 10:54 pm #1548563Hi jlwood44,
I’m not sure why you mention “index,” the purpose of which is to allow the database management system to more quickly fetch database rows that match the query criteria. A database would have to be quite large before the overhead of creating an index would be outweighed by the benefit.Also, perhaps you could more clearly explain what you consider “duplicate,” that is, what field(s) you want to essentially be the unique identifier. Would it be player and year, so that there would be only one result for , namely, the result where free throws made over the three games was highest for that combination of player and year? If there were several rows for a given player and year that had the same three-game sum (as for ), which one would you want selected?
It might help also if you provided the query statement(s) you’re using.
Hope this helps,
DaveI agree with your assessment that I find all those with the same name and season, and have only 1 entry, and the others are duplicates. I used the duplicate query and used Roster_ID to find the results, BUT I expected that the ‘original’ would be the top one in the sorted query. When I ran the duplicates, as you can see the duplicates include the top records.
43378-SQL-for-the-duplicates
It appears that the sorting happens AFTER the duplicates are determined. If the sorting is done before the duplicates are determined, then the appropriate listing would be created.
-
-
WSjlwood44
AskWoody LoungerJanuary 24, 2016 at 6:17 am #1548577I think that I misunderstood what the duplicate query would show. I was thinking that it would show the 2nd, 3rd, etc. occurrence of a record, when if there are duplicates, it shows the 1st, 2nd, 3rd occurrence of the record. Then the duplicate query was ‘correct’ as it ran. BUT, it still brings up my other question, how do I (really ACCESS) remove the records after the ‘original’ record.
I think back to a year ago when I ran a duplicate query for a table to find if I had entered results more than once, and it showed both occurrences. Because this was records in a table, and it was only 1 or 2 duplicates, I manually deleted the duplicates.
In this case, the ‘original’ info is from a query search. I do NOT want to remove the inputted data, but ‘restrict’ the results from the search to only show the ‘first’ occurrence. And more data is constantly being added – Vironnica just had a game where she made 14 free throws – I’m not sure what her consecutive game results were. -
WSruirib
AskWoody LoungerJanuary 24, 2016 at 6:30 am #1548578I think you have a bigger problem. How can you be having multiple records where many of columns are different between these multiple records, and yet you still call them duplicates? I think your problem is the actual query that is creating these records. Shouldn’t your query be creating just one record per player per season?
-
WSDavidHLevin
AskWoody LoungerJanuary 24, 2016 at 7:43 am #1548584Hi jlwood44,
I agree with Rui that “find duplicates” is apparently being used here in a way for which it wasn’t really intended.Also, the tables might have been designed to be more robust. Suppose a player had a given three-game FTM sequence occur more than once in a season, such as 12 in game 3, 9 in game 4, and 10 in game 5 and then 12 in game 17, 9 in game 18, and 10 in game 19. This could be accommodated if an additional field that I’ll call g1_number were in the table that contains the FTM triplets. This would allow and to coexist.
These entries wouldn’t be “duplicates”; they would be in conformance with the table layout. This representation would show where a player achieved a given three-day total more than once in a season, but you could still obtain one query row by including the appropriate criteria in the select statement, and your select statement could specify that the results were to be sorted descending by year.
Perhaps if you posted the present tables and explained what the FTM data are used for, we would be able to offer more specific suggestions.
Dave
-
WSruirib
AskWoody LoungerJanuary 24, 2016 at 9:00 am #1548585Do you want a single record per player? Or do you want the overall top 3 consecutive games with most free throws made?
In any case, you can take the query you have now and use it as the entry table for a new query. Then you apply a condition that selects what you want: a TOP 3 SELECT clause, for the latter, or a use a correlated subquery in the WHERE clause or something close to either or both, depending on what you want.
-
WSjlwood44
AskWoody LoungerJanuary 24, 2016 at 9:03 pm #1548643 -
WSruirib
AskWoody Lounger -
WSjlwood44
AskWoody LoungerJanuary 25, 2016 at 10:39 am #1548740SQL for ‘original’ Query
SELECT Most_FT_3g_v2_3_Query.Player_ID, Most_FT_3g_v2_3_Query.Roster_ID, Most_FT_3g_v2_3_Query.Fall_Year, Most_FT_3g_v2_3_Query.Full_Name, Most_FT_3g_v2_3_Query.g1FTM, Most_FT_3g_v2_3_Query.g2FTM, Most_FT_3g_v2_3_Query.g3FTM, Most_FT_3g_v2_3_Query.Tot3gFTM, Most_FT_3g_v2_3_Query.Tot3gFTA
FROM Most_FT_3g_v2_3_Query
ORDER BY Most_FT_3g_v2_3_Query.Tot3gFTM DESC , Most_FT_3g_v2_3_Query.Game_ID DESC;SQL for duplicates Query
SELECT Most_FT_3g_v2_6_Query.Roster_ID, Most_FT_3g_v2_6_Query.Full_Name, Most_FT_3g_v2_6_Query.Player_ID, Most_FT_3g_v2_6_Query.Fall_Year, Most_FT_3g_v2_6_Query.g1FTM, Most_FT_3g_v2_6_Query.g2FTM, Most_FT_3g_v2_6_Query.g3FTM, Most_FT_3g_v2_6_Query.Tot3gFTM, Most_FT_3g_v2_6_Query.Tot3gFTA
FROM Most_FT_3g_v2_6_Query
WHERE (((Most_FT_3g_v2_6_Query.Roster_ID) In (SELECT [Roster_ID] FROM [Most_FT_3g_v2_6_Query] As Tmp GROUP BY [Roster_ID] HAVING Count(*)>1 )))
ORDER BY Most_FT_3g_v2_6_Query.Tot3gFTM DESC; -
WSruirib
AskWoody LoungerJanuary 25, 2016 at 11:47 am #1548748Replace your original query by a query based on this SQL statement. Should be enough for what you want.
Code:SELECT M.Player_ID, M.Roster_ID, M.Fall_Year, M.Full_Name, M.g1FTM, M.g2FTM, M.g3FTM, M.Tot3gFTM, M.Tot3gFTA FROM Most_FT_3g_v2_3_Query As M WHERE M.Tot3gFTM = (SELECT MAX(T.Tot3gFTM) FROM Most_FT_3g_v2_3_Query As T WHERE [COLOR="#FF0000"]T.Player_ID=M.Player_ID[/COLOR])
I have a doubt, though. It is possible that the condition in red has to be replaced by T.Roster_ID=M.Roster_ID
This latter version would probably give you multiple seasons for the same player, if the Most_FT_3g_v2_3_Query query gives you values for multiple seasons. If not, the replacement is not needed, even if it can still be performed.
-
WSjlwood44
AskWoody LoungerJanuary 26, 2016 at 10:11 am #154892243394-Run-of-Query-without-duplicates
That kind of works. And, I changed to Roster_ID so that a player might be listed for different years. BUT that seems to want to find matching results for a player. Vironnica Drake is listed with 2 times of 31 makes, but she has one of 36, and maybe a couple others bigger than the 31. Katrinna Blackmon had a 29 and a couple others in the 20’s. According to your query run the 2nd highest total is 16. -
WSruirib
AskWoody LoungerJanuary 26, 2016 at 10:29 am #1548932Well, if you want it ordered on M.Tot3gFTA, the subquery needs to get the max of T.Tot3gFTA and not T.Tot3gFTM.
Code:SELECT M.Player_ID, M.Roster_ID, M.Fall_Year, M.Full_Name, M.g1FTM, M.g2FTM, M.g3FTM, M.Tot3gFTM, M.Tot3gFTA FROM Most_FT_3g_v2_3_Query As M WHERE M.Tot3gFTM = (SELECT MAX(T.Tot3gFTA) FROM Most_FT_3g_v2_3_Query As T WHERE T.Roster_ID=M.Roster_ID)
Yeah, it can show repeats for a player, if the player has multiple instances with the same Tot3gFTA total value. If you want to specify a tie breaking criterium, I may try and solve it.
-
WSjlwood44
AskWoody LoungerJanuary 26, 2016 at 1:22 pm #1548968You misunderstood my concern. Look at the results from #12, and compare with #1.
I want the MAX for Tot3gFTM, but the query in #12 is NOT showing the top totals as shown in both parts of #1
What happened to Drake making 36 free throws, Blackmon making 29, Guarneri making 26, R. Drake making 25? For some reason none of these are showing in the new query. The next to last field is what really matters.
Although the query seems to ask for MAX, it does not seem to show the actual MAX. -
WSruirib
AskWoody LoungerJanuary 26, 2016 at 2:55 pm #1548989You misunderstood my concern. Look at the results from #12, and compare with #1.
I want the MAX for Tot3gFTM, but the query in #12 is NOT showing the top totals as shown in both parts of #1
What happened to Drake making 36 free throws, Blackmon making 29, Guarneri making 26, R. Drake making 25? For some reason none of these are showing in the new query. The next to last field is what really matters.
Although the query seems to ask for MAX, it does not seem to show the actual MAX.I only work with what you give me and it seems you gave me two different queries – V2_6 and V2_3. I don’t know enough about your queries to distinguish them. It seems the queries are different and give different results. The solution seems obvious to me: if you want the results from V2_6, use V2_6. and change the SQL for the query I wrote accordingly – replace all references to V2_3 with V2_6.
-
-
WSjlwood44
AskWoody LoungerFebruary 2, 2016 at 1:02 pm #1550093I have not had a chance to evaluate your answer for several days. v2_3 DOES have Tot3gFTM results greater than 31. I also was getting a parameter request for running each of the queries. I figured out how to replace the ‘alias’ request, so that the parameter does not show. Now when I ran it today it did show V Drake with 36 FTM and Blackmon with 29 FTM and several others also with 20+. I did have Julia Cardwell show 3 times for this season, but all 3 had her with 19 FTM. Not major, but is there a way to have her showing only once. Would the term UNIQUE or DISTINCT be helpful?
-
WSruirib
AskWoody Lounger
Viewing 13 reply threads -

Plus Membership
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Get Plus!
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Search Newsletters
Search Forums
View the Forum
Search for Topics
Recent Topics
-
Sometimes I wonder about these bots
by
Susan Bradley
32 minutes ago -
Does windows update component store “self heal”?
by
Mike Cross
2 hours, 30 minutes ago -
Windows 11 Insider Preview build 27858 released to Canary
by
joep517
3 hours, 30 minutes ago -
Pwn2Own Berlin 2025: Day One Results
by
Alex5723
2 hours, 55 minutes ago -
Windows 10 might repeatedly display the BitLocker recovery screen at startup
by
Susan Bradley
3 hours, 37 minutes ago -
Windows 11 Insider Preview Build 22631.5409 (23H2) released to Release Preview
by
joep517
6 hours, 12 minutes ago -
Windows 10 Build 19045.5912 (22H2) to Release Preview Channel
by
joep517
6 hours, 14 minutes ago -
Kevin Beaumont on Microsoft Recall
by
Susan Bradley
6 minutes ago -
The Surface Laptop Studio 2 is no longer being manufactured
by
Alex5723
14 hours, 21 minutes ago -
0Patch, where to begin
by
cassel23
8 hours, 23 minutes ago -
CFPB Quietly Kills Rule to Shield Americans From Data Brokers
by
Alex5723
1 day, 3 hours ago -
89 million Steam account details just got leaked,
by
Alex5723
15 hours, 44 minutes ago -
KB5058405: Linux – Windows dual boot SBAT bug, resolved with May 2025 update
by
Alex5723
1 day, 12 hours ago -
A Validation (were one needed) of Prudent Patching
by
Nibbled To Death By Ducks
1 day, 3 hours ago -
Master Patch Listing for May 13, 2025
by
Susan Bradley
14 hours, 38 minutes ago -
Installer program can’t read my registry
by
Peobody
9 hours, 36 minutes ago -
How to keep Outlook (new) in off position for Windows 11
by
EspressoWillie
1 day, 1 hour ago -
Intel : CVE-2024-45332, CVE-2024-43420, CVE-2025-20623
by
Alex5723
1 day, 8 hours ago -
False error message from eMClient
by
WSSebastian42
1 day, 23 hours ago -
Awoke to a rebooted Mac (crashed?)
by
rebop2020
2 days, 8 hours ago -
Office 2021 Perpetual for Mac
by
rebop2020
2 days, 9 hours ago -
AutoSave is for Microsoft, not for you
by
Will Fastie
1 day, 6 hours ago -
Difface : Reconstruction of 3D Human Facial Images from DNA Sequence
by
Alex5723
2 days, 13 hours ago -
Seven things we learned from WhatsApp vs. NSO Group spyware lawsuit
by
Alex5723
1 day, 14 hours ago -
Outdated Laptop
by
jdamkeene
2 days, 18 hours ago -
Updating Keepass2Android
by
CBFPD-Chief115
3 days ago -
Another big Microsoft layoff
by
Charlie
2 days, 23 hours ago -
PowerShell to detect NPU – Testers Needed
by
RetiredGeek
2 hours, 7 minutes ago -
May 2025 updates are out
by
Susan Bradley
3 hours, 49 minutes ago -
Windows 11 Insider Preview build 26200.5600 released to DEV
by
joep517
3 days, 6 hours ago
Recent blog posts
Key Links
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.