Link to home
Start Free TrialLog in
Avatar of marcgu
marcguFlag for Sweden

asked on

How to turn multiple rows into one row in oracle without creating functions or views

In my database, I have e.g following 2 rows

SSSN                           UNIT           INDV     PROF
330511-000      GYMBER01      INDV          NULL      
330511-000      GYMBER01      NULL          PROF

I want it displayed like this, that is: only one row

SSSN                           UNIT             INDV              PROF
330511-000      GYMBER01        INDV             PROF      




I know how to achieve this by Writing functions or multiple views which I then join, but I would also be good to be able to achieve this if I only have read-rights in the db.

This is the code that returns the first to rows:

select  ssn, UNIT,

case  when kurskod='INDV' then kurskod  end AS INDV,
case  when kurskod='PROF' then kurskod  end AS PROF

from aktivitet

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Sean Stuber
Sean Stuber

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of marcgu

ASKER

Hi!

Great solutions. I give sdstuber most since it was posted first and complete.