Adding columns for group by result values in oracle

by Dilshan   Last Updated September 11, 2019 09:06 AM

Lets say my table like this and the table name is Employee.

Employee ID         Name               Age
   1                Dilshan             22
   2                Udara               25
   3                Malith              45
   4                Dilshan             40

select Name,Age from Employee
group by Name,Age;

the results will be like this.

Dilshan             22
Dilshan             40
Udara               25
Malith              45

what i want is to have a separate columns for to show all ages per employee name. My intended results are like this. I'm using oracle 11g.

Name               Age1     Age2
Dilshan             22       40
Udara               25       null
Malith              45       null


Related Questions


Updated February 05, 2018 08:06 AM

Updated July 03, 2016 08:02 AM

Updated February 24, 2017 12:06 PM

Updated August 28, 2017 14:06 PM

Updated August 02, 2018 06:06 AM