marcgu
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
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
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Great solutions. I give sdstuber most since it was posted first and complete.