I'm trying to create a query that will return the top value when multiple rows are retrieved for one person.
For example, I have a person table. A person can be entered multiple times depending on the type (employee, former employee, retired, part time, faculty, former faculty).
Select id, type
from people
where type = 'employee' or
type = 'former employee' or
type = 'faculty' or
type = 'retired'
Sample output...
ID: Type:
1 employee
2 faculty
2 former employee
3 retired
What I need is to display only the top record if there are multiple rows per ID. I can not use select distinct, as that limits me to only pulling the ID number. I need to display the type field.
The output I'm looking to capture:
1 employee
2 faculty
3 retired
Any help would be appreciated!
-Heather
For example, I have a person table. A person can be entered multiple times depending on the type (employee, former employee, retired, part time, faculty, former faculty).
Select id, type
from people
where type = 'employee' or
type = 'former employee' or
type = 'faculty' or
type = 'retired'
Sample output...
ID: Type:
1 employee
2 faculty
2 former employee
3 retired
What I need is to display only the top record if there are multiple rows per ID. I can not use select distinct, as that limits me to only pulling the ID number. I need to display the type field.
The output I'm looking to capture:
1 employee
2 faculty
3 retired
Any help would be appreciated!
-Heather