Hi guys (and gals?). I'm running into a snag with a database I am writing and I could really use some help. I'm at my wits end.
I have a table that stores a patient id, a record id, 3 fields for race, and other data. The main part looks something like this.
Pat_ID Rec_ID Race1 Race2 Race3
----------------------------------------------------------------
12345678 1 White Null Null
12345678 2 White Null Null
98765432 1 White Black Null
98765432 2 Black White Null
98765432 3 Asian Null Null
Basically, what I am trying to do is locate patients in which all of the race fields do not match up. Race fields that are swapped (like in the 3rd and 4th record) are ok. Its the fifth record in which the person is asian that sticks out. I'd like the result of the query to be a list of records that did not have a duplicate. I have already removed patients with only one record from the table so this table only contains patients with more than one record.
The result I am looking for would be:
Pat_ID Rec_ID Race1 Race2 Race3
----------------------------------------------------------------
98765432 3 Asian Null Null
I've tried many variations of different queries but none of them seem to be working. Many many thanks to anyone who might be able to help.
I have a table that stores a patient id, a record id, 3 fields for race, and other data. The main part looks something like this.
Pat_ID Rec_ID Race1 Race2 Race3
----------------------------------------------------------------
12345678 1 White Null Null
12345678 2 White Null Null
98765432 1 White Black Null
98765432 2 Black White Null
98765432 3 Asian Null Null
Basically, what I am trying to do is locate patients in which all of the race fields do not match up. Race fields that are swapped (like in the 3rd and 4th record) are ok. Its the fifth record in which the person is asian that sticks out. I'd like the result of the query to be a list of records that did not have a duplicate. I have already removed patients with only one record from the table so this table only contains patients with more than one record.
The result I am looking for would be:
Pat_ID Rec_ID Race1 Race2 Race3
----------------------------------------------------------------
98765432 3 Asian Null Null
I've tried many variations of different queries but none of them seem to be working. Many many thanks to anyone who might be able to help.
Last edited: