Home » SQL & PL/SQL » SQL & PL/SQL » displaying rows into columns
displaying rows into columns [message #263860] Fri, 31 August 2007 03:32 Go to next message
thisisnatesh
Messages: 92
Registered: March 2007
Member
i have a table like

empno Jan_bonus Feb_bonus Mar_bonus
e100......200
e100......................300
e100...........................................400

this is a table which gives bonus given to employee in the following months.

i want to display the above as

empno Jan_bonus Feb_bonus Mar_bonus

e100...200................300...............400

Can i display the record like this.. please help me in this regard.
Re: displaying rows into columns [message #263864 is a reply to message #263860] Fri, 31 August 2007 03:36 Go to previous messageGo to next message
Michel Cadot
Messages: 64151
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
clue: max(%_bonus) group by empno

Regards
Michel
Re: displaying rows into columns [message #263865 is a reply to message #263860] Fri, 31 August 2007 03:36 Go to previous messageGo to next message
vamsi kasina
Messages: 2107
Registered: October 2003
Location: Riyadh, Saudi Arabia
Senior Member
Edit: I have read the question wrongly. Sorry

By
Vamsi

[Updated on: Fri, 31 August 2007 03:37]

Report message to a moderator

Re: displaying rows into columns [message #264116 is a reply to message #263860] Fri, 31 August 2007 22:45 Go to previous message
muzahid
Messages: 281
Registered: September 2004
Location: Dhaka, Bangladesh
Senior Member
select empno,
sum(nvl(jan_bonus,0)) jan_bonus,
sum(nvl(feb_bonus,0)) feb_bonus,
sum(nvl(mar_bonus,0)) mar_bonus
from yourtab
group by empno
Previous Topic: output blob to HTML page
Next Topic: BUFFER OVERFLOW PROBLEM
Goto Forum:
  


Current Time: Fri Dec 09 21:35:28 CST 2016

Total time taken to generate the page: 0.23942 seconds