delete duplicates

prasadgov

Member
Local time
Today, 04:04
Joined
Oct 12, 2021
Messages
120
Hi,

Is there a way to delete the second occurrence from a table entry where there are duplicates sessions?

1715698110643.png


For example, I need to delete the second occurrence of CDS4 since a Registrant cannot attend two courses in the same session.
I need a query which deletes the second occurrence of all the sessions where a Registrant has entered two courses.

TIA
 
in Access query, I am not sure if "Exists" can be used
 
And how did you become very sure of that? Did you post on forums and get an answer and wash your hands of it? Or did you confirm it for yourself as Dbguy suggested?

You missed the bigger picture.
 
Who is the question for?
EXISTS is part of the ANSI89 language set that Jet-SQL (=Access-SQL) uses. So you can use it, and I haven't seen a case where it didn't work if you use it correctly, i.e. in conjunction with a correlated subquery.
I have already written a lot of queries so that the one linked above could be written from the abstraction without having to test it separately.

I also find this design very clear and easy to understand and prefer it to other variants with a JOIN (which also exist).
 
delete the second occurrence
A query is mass data processing - all at once. Therefore, you immediately need a secure and reliable attribute for a first or second occurrence in order to be able to delete accurately. I don't trust myself to derive a reliable rule from a random(?) example.
 

Users who are viewing this thread

Back
Top Bottom