I have a Students table like this:
Name | Duplicate |
---|---|
John | no |
Stacy | no |
Kate | yes |
John | yes |
Stacy | yes |
Kate | yes |
It is supposed to be the first record is not flagged as a duplicate but if I receive a repeat record that is flagged as a duplicate. I am trying to write a query that checks if there are any distinct names that are all flagged as duplicates. In this example table, all Kate records are flagged as duplicate so the query should only return Kate.
I have tried:
select distinct Name from Students where duplicate='yes'
but this returns John, Kate, and Stacy
You can try doing it direct, as far as I can see, you want
Name
such thatDuplicate = 'yes'
recordsDuplicate = 'yes'
records; i.e. recordsDuplicate = 'yes'
should not exist