I've a table EMPLOYEE which has columns like these
EmpId FName LName
I have another table ADDRESS which has columns like these
EmpId AddressType Address Phone Email AddressType column has 2 possible types, Residential and Official and an Emp can have both types of address.
I need a query which will join these 2 tables using EmpId.
It also needs to fetch one address which has phone not null.
If both addresses has phone, then fetch any one, if none has phone, still fetch any one.
Please help.