Hi All,
Empno|Ename|Salary|Location
101 |Reddy|100000|Hyd
102 |John |200000|Delhi
103 |peter|000000|bangalore
One column need to displayed into two columns as per the below queries
Select empno,salary from emp where Ename =Peter
select empno,salary from emp where Ename=Reddy
based on the above conditions peters salary come in one column and reddy salary come in other column as below
Output
empno |salary|Alias salary
103 |NULL |0000000
101 |100000|NULL
DB2 Query
Moderators: chulett, rschirm, roy
Are you selecting only two rows?
Code: Select all
Select empno,NULL,salary from emp where Ename =Peter
Union All
select empno,salary,NULL from emp where Ename=Reddy
You are the creator of your destiny - Swami Vivekananda