Adding columns for group by result values in oracle

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

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

Altering the location of Oracle-Suggested Backup

Updated July 03, 2016 08:02 AM

Ways to Schedule Rman backups

Updated February 24, 2017 12:06 PM

EMCA insists that it cannot connect to the service

Updated August 28, 2017 14:06 PM

Password for Oracle Database 18c user “system”

Updated August 02, 2018 06:06 AM