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

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -