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 ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| 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 |
| |||
| 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 |
| ||||
| 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 |