dbTalk Databases Forums  

How can I get sum report as this one?

comp.databases.oracle.misc comp.databases.oracle.misc


Discuss How can I get sum report as this one? in the comp.databases.oracle.misc forum.

Reply
 
Thread Tools Display Modes
  #1  
Old   
ilkin.esrefli (AT) gmail (DOT) com
 
Posts: n/a

Default How can I get sum report as this one? - 05-12-2006 , 02:32 AM






Hello!!
I want to get result on Oracle as this one:

------------------
NAME PRICE
--------- ------
book 75.00
pen 12.35
notebook 5.05
<total> 92.4
------------------

I know that i may write query as this:
SELECT name, price FROM tbprices
UNION
SELECT 'total', sum(price) FROM tbprices

but it's not good.. I have long query and this method makes long time
and do one thing two times..
Is there any short solution about that..?

best Regards...Thanks




Reply With Quote
  #2  
Old   
Carlos
 
Posts: n/a

Default Re: How can I get sum report as this one? - 05-12-2006 , 03:20 AM






Quote:
Is there any short solution about that..?
As the Wise Man (TK) says:

"Analytics rock, Analytics roll... "

Cheers.

Carlos.



Reply With Quote
  #3  
Old   
gazzag
 
Posts: n/a

Default Re: How can I get sum report as this one? - 05-12-2006 , 09:10 AM



ilkin.esrefli (AT) gmail (DOT) com wrote:
Quote:
Hello!!
I want to get result on Oracle as this one:

------------------
NAME PRICE
--------- ------
book 75.00
pen 12.35
notebook 5.05
total> 92.4
------------------

I know that i may write query as this:
SELECT name, price FROM tbprices
UNION
SELECT 'total', sum(price) FROM tbprices

but it's not good.. I have long query and this method makes long time
and do one thing two times..
Is there any short solution about that..?

best Regards...Thanks
Look up BREAK, COMPUTE and SUM in your SQL*Plus documentation.

HTH

-g



Reply With Quote
  #4  
Old   
DA Morgan
 
Posts: n/a

Default Re: How can I get sum report as this one? - 05-12-2006 , 12:41 PM



ilkin.esrefli (AT) gmail (DOT) com wrote:
Quote:
Hello!!
I want to get result on Oracle as this one:

------------------
NAME PRICE
--------- ------
book 75.00
pen 12.35
notebook 5.05
total> 92.4
------------------
Go to Morgan's Library at www.psoug.org and click on Analytic Functions.
Scroll down to the SUM demo.
--
Daniel A. Morgan
University of Washington
damorgan@x.washington.edu
(replace x with u to respond)
Puget Sound Oracle Users Group
www.psoug.org


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.