Hi folks,
I want to union two tables into one row per empno
SELECT EMPNO, EMAIL , ' '
FROM EMP_T
UNION ALL
SELECT EMPNO, ' ', MGREMAIL
FROM MGR_T
tables look like this:
EMP_T
EMPNO EMAIL
------- ----------
0001 emp1@123.com
0002 emp2@123.com
0003 emp3@123.com
MGR_T
EMPNO MGREMAIL
------- -----------------------------
0001 mgr1@123.com
0002 mgr2@123.com
0004 mgr3@123.com
0003 mgr4@123.com
I want the result to look like this:
EMPNO email mgremail
------- -------------------- --------------------
0001 emp1@123.com mgr1@123.com
0002 emp2@123.com mgr2@123.com
0004 mgr3@123.com
0003 emp3@123.com mgr4@123.com
Any suggestions ?
Thanks
I want to union two tables into one row per empno
SELECT EMPNO, EMAIL , ' '
FROM EMP_T
UNION ALL
SELECT EMPNO, ' ', MGREMAIL
FROM MGR_T
tables look like this:
EMP_T
EMPNO EMAIL
------- ----------
0001 emp1@123.com
0002 emp2@123.com
0003 emp3@123.com
MGR_T
EMPNO MGREMAIL
------- -----------------------------
0001 mgr1@123.com
0002 mgr2@123.com
0004 mgr3@123.com
0003 mgr4@123.com
I want the result to look like this:
EMPNO email mgremail
------- -------------------- --------------------
0001 emp1@123.com mgr1@123.com
0002 emp2@123.com mgr2@123.com
0004 mgr3@123.com
0003 emp3@123.com mgr4@123.com
Any suggestions ?
Thanks
Comment