Home » Other » Test » Show Sum (SQL,Oracle 9.2.0.8.0,XP)
Show Sum [message #311048] Thu, 03 April 2008 05:19 Go to next message
gozuhair
Messages: 206
Registered: January 2008
Senior Member
I am using the following query


SELECT empNo,
sal
FROM abc
GROUP BY ROLLUP(sal,empNo);


The above query show the following output.

EMPNO SAL
----- ---------
100 1
1
100 2
2
1000 3
3

My Desired Output is .

EMPNO SAL
----- ---------
100 1
100 2
1000 3
1200

(means 1200 equal to 100+100+1000)




Re: Show Sum [message #311061 is a reply to message #311048] Thu, 03 April 2008 05:37 Go to previous messageGo to next message
Michel Cadot
Messages: 68624
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
You must also use code tags for results, otherwise columns are not aligned and results are unreadable.

Regards
Michel
Re: Show Sum [message #311064 is a reply to message #311048] Thu, 03 April 2008 05:41 Go to previous messageGo to next message
gozuhair
Messages: 206
Registered: January 2008
Senior Member
I am using the following query

SELECT empNo,
sal
FROM abc
GROUP BY ROLLUP(sal,empNo);



The above query show the following output.

EMPNO SAL
----- ---------
100 1
1
100 2
2
1000 3
3



My Desired Output is .

EMPNO SAL
----- ---------
100 1
100 2
1000 3
1200

(means 1200 equal to 100+100+1000)
Re: Show Sum [message #311186 is a reply to message #311064] Thu, 03 April 2008 11:55 Go to previous messageGo to next message
Littlefoot
Messages: 21806
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
gozuhair, being member of the OraFAQ Forum for a several months now, I believe you understand that "Test" forum (the place you chose to put your question in) is NOT supposed to be used for any other purpose that pure testing battlefield.

So, if this is a real question, would you like us to move it to a more appropriate forum? If so, which one would you choose?

Besides, what did you exactly align in your previous post? You did use [code] tags, but - test your skills some more, as 'sal' column isn't aligned at all.

[Updated on: Thu, 03 April 2008 11:56]

Report message to a moderator

Re: Show Sum [message #311195 is a reply to message #311186] Thu, 03 April 2008 12:19 Go to previous messageGo to next message
Michel Cadot
Messages: 68624
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
The real question was posted in Newbie forum.

Regards
Michel
Re: Show Sum [message #311208 is a reply to message #311195] Thu, 03 April 2008 13:05 Go to previous messageGo to next message
Littlefoot
Messages: 21806
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Oh! Was it? Thank you for letting me know; now I can go to /forum/fa/1774/0/
Re: Show Sum [message #311212 is a reply to message #311208] Thu, 03 April 2008 13:15 Go to previous messageGo to next message
Michel Cadot
Messages: 68624
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Yes it was: http://www.orafaq.com/forum/t/100087/102589/ Smile

Good night, see you at /forum/fa/1598/0/
Michel
Re: Show Sum [message #311347 is a reply to message #311048] Fri, 04 April 2008 03:08 Go to previous message
gozuhair
Messages: 206
Registered: January 2008
Senior Member
Thanks for the reply
Previous Topic: Conditional Replication Streams
Next Topic: Test message
Goto Forum:
  


Current Time: Thu Mar 28 10:05:14 CDT 2024