Duplicate Values - Selecting One Record Based on Max Value
Hi All,
I need to run a query that selects one value in a set of duplicates. I'll need to select a record where a column has max value.
So I have 3 columns:
Person_Identifier,
Birth Date,
Primary_Key_column
In my existing table I have some data error issues where a given person has more than one birth date. The data contains multiple years so for one year a birth date was given but in another year the person has a different birth date, usually the days or months are reversed or whatever. I have to take the last recorded birth date and use that record. So I'm taking the max(Primary_Key_column) and selecting the birth date from there. So for example:
Two Records Exist in the Table:
Person_Identifier Birth Date Primary_Key_column Row_No
999999 1999-02-03 500 1
999999 1999-03-02 499 2
So in the case above, I want to be able to select Record #1 (Row_No = 1) because the Primary Key Column is the max value and I want to take the Person_Identifier and Birth Date fields for that record.
Hope this makes sense.
Thanks