I have a table of phone numbers with the following structure:
PersonID, PhoneType, PhoneNumber
Each person can have several phone numbers with different types, and not everybody has the same type.
I am looking for a view which gives me just one phone number, selected by a pre-established order of phonetype. Whenever the view has found this type, it should continue to the next person.
my selected order is: HOME - WORK - CELL
then the view should contain:
How would I write this select statement?