oracle - Multiple rows of SQL in single row under different columns -


please find below example:

empid.   compcode.     amount 101.        basic.     1000 101.        hra.       200 102.        basic.     1200 102.        hra.       200 102.        medical.   100 

i format data shown below:

emplid     basic.  hra.      medical 101.       1000.   200.      102.       1200.   200.      100 

is there way generate output using oracle sql?

your problem solve using pivot in sql.

select * (     select         empid,compcode,amount tablename ) s pivot (     sum(amount)     compcode in ('basic', 'hra', 'medical') )as pvt 

Comments

Popular posts from this blog

android - net_scheduler holding wakelock -

sql - MySQL : Getting Entries from a many-to-many table -

java - Retrieving data from database using jsp (Hibernate + Spring + Maven) -