Data manipulation

I have the following tables

MEMBER
MEMBER_ID
MEMBERNO
NAME
SPOUSENO
SPOUSENAME

MEMBERFAMILY
USERNO
USERNAME
USERSPOUSENO
USERSPOUSENAME

I want the output to be

USERNO        USERNAME

EXPLANATION
USERNO WILL DISPLAY MEMBERNO, SPOUSENO, USERNO, USERSPOUSENO

USENAME WILL DISPLAY CORRESPONDING NAME, SPOUSENAME, USERNAME, USERSPOUSENAME

How do I achieve this?
GRChandrashekarAsked:
Who is Participating?
 
Amitkumar PConnect With a Mentor Sr. ConsultantCommented:
select distinct MEMBERNO as userno, NAME as username from MEMBER
union
select distinct SPOUSENO as userno, SPOUSENAME as username from MEMBER
union
select distinct USERNO as userno, USERNAME as username from MEMBERFAMILY
union
select distinct USERSPOUSENO as userno, USERSPOUSENAME as username from MEMBERFAMILY;



0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.