Employees may have any number of phone numbers (or none) listed in our database. I would like an easy way to filter the query rows down to only one phone number per employee, based on a preferential list of phone types:
H1
HM
H2
WM
W1
W2
A
B
C
X
Y
Z
In other words, if they have an "H1" PHONE_TYPE, I'd like to get that PHONE_NUMBER. If not, my second choice would be their "HM" phone number, if they have one. Otherwise, I'll go down the list and take whatever they've got next.
If they don't have any phone listed, I'd like to return a literal "none".
I'm pretty new at SQL queries and not sure if this should be some kind of CASE in the SELECT clause or what. Simpler is better for me right now.
Thanks!