delete duplicates (1 Viewer)

prasadgov

New member
Local time
Yesterday, 21:39
Joined
Oct 12, 2021
Messages
23
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
 

prasadgov

New member
Local time
Yesterday, 21:39
Joined
Oct 12, 2021
Messages
23
in Access query, I am not sure if "Exists" can be used
 

plog

Banishment Pending
Local time
Yesterday, 20:39
Joined
May 11, 2011
Messages
11,680
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.
 

ebs17

Well-known member
Local time
Today, 03:39
Joined
Feb 7, 2020
Messages
2,020
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).
 

ebs17

Well-known member
Local time
Today, 03:39
Joined
Feb 7, 2020
Messages
2,020
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

Top Bottom