Unix Technical Forum

How can I get sum report as this one?

This is a discussion on How can I get sum report as this one? within the Oracle Miscellaneous forums, part of the Oracle Database category; --> Hello!! I want to get result on Oracle as this one: ------------------ NAME PRICE --------- ------ book 75.00 pen ...


Go Back   Unix Technical Forum > Database Server Software > Oracle Database > Oracle Miscellaneous

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-08-2008, 10:27 AM
ilkin.esrefli@gmail.com
 
Posts: n/a
Default How can I get sum report as this one?

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

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-08-2008, 10:27 AM
Carlos
 
Posts: n/a
Default Re: How can I get sum report as this one?

>>Is there any short solution about that..?

As the Wise Man (TK) says:

"Analytics rock, Analytics roll... "

Cheers.

Carlos.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-08-2008, 10:27 AM
gazzag
 
Posts: n/a
Default Re: How can I get sum report as this one?

ilkin.esrefli@gmail.com wrote:
> 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

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 04-08-2008, 10:27 AM
DA Morgan
 
Posts: n/a
Default Re: How can I get sum report as this one?

ilkin.esrefli@gmail.com wrote:
> 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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
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
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 06:22 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com