Feature: How to get subtotals and total general whole?
I am wrtiting a report using SQL and SQL * more to get subtotals and a total general. The COMPUTE function allows me to CALCULATE SUM on a group, but it only gives me subtotals. I am interested in getting a report with subtotals and a final OVERALL TOTAL. Is this possible using SQL * more?Here is my current code that gives me subtotals:
COMPUTE SUM LABEL subtotal OF sal ON deptno
SELECT ename, sal, deptno
FROM emp
ORDER BY deptno;
ENAME SAL DEPTNO
---------- ---------- ----------
CLARK 2450 10
VOLLMAN 5000
MILLER 1300
---------- **********
8750 subtotal
SMITH 800 20
ADAMS 1100
FORD 3000
SCOTT 3000
JONES 2975
---------- **********
10875 subtotal
ALLEN 1600 30
BLAKE 2850
MARTIN 1250
JAMES 950
TURNER 1500
WARD 1250
---------- **********
9400 subtotal
Here is the code for a grand total:Column DUMMY NOPRINT
COMPUTE SUM OF sal ON DUMMY
BREAK ON DUMMY
SELECT NULL DUMMY, ename, sal, deptno
FROM emp
ORDER BY deptno;
ENAME SAL DEPTNO
---------- ---------- ----------
CLARK 2450 10
VOLLMAN 5000 10
MILLER 1300 10
SMITH 800 20
ADAMS 1100 20
FORD 3000 20
SCOTT 3000 20
JONES 2975 20
ALLEN 1600 30
BLAKE 2850 30
MARTIN 1250 30
JAMES 950 30
TURNER 1500 30
WARD 1250 30
----------
29025
How can I combine the two on a single report?
Hello
If you want to do with the SQL * Plus COMPUTE command, just give another CALCULATION order "CARRY ON".
Add 'REPORT ON' to the PAUSE command, also.
BREAK ON deptno ON REPORT
COMPUTE SUM LABEL subtotal OF sal ON deptno
COMPUTE SUM LABEL grandtotal OF sal ON REPORT
SELECT ename, sal, deptno
FROM scott.emp
ORDER BY deptno;
Output:
ENAME SAL DEPTNO
---------- ---------- ----------
CLARK 2450 10
KING 5000
MILLER 1300
---------- **********
8750 subtotal
JONES 2975 20
FORD 3000
ADAMS 1100
SMITH 800
SCOTT 3000
---------- **********
10875 subtotal
WARD 1250 30
TURNER 1500
ALLEN 1600
JAMES 950
BLAKE 2850
MARTIN 1250
---------- **********
9400 subtotal
----------
grandtotal 29025
14 rows selected.
Tags: Database
Similar Questions
-
What is Belarc Advisor and how to get it and use it?
What is Belarc Advisor and how to get it and use it?
Don't try real hard to figure that one out yourself, huh? Heh
http://www.Google.com/search?q=what+is+Belarc+Advisor
Search example:
- http://www.Hoax-Slayer.com/Belarc-review.html
- 8078 order, http://www.PCWorld.com/downloads/file/FID, 4/description.html
- http://fileforum.betanews.com/detail/Belarc-Advisor/1042897635/1
- http://www.TechRepublic.com/article/gather-detailed-system-information-with-Belarc-Advisor/6177700
The best place, probably, for more information about the application/utility is probably:
http://www.Belarc.com/free_download.htmlMore directly:
The Belarc Advisor generates a detailed profile of your installed software and hardware, network inventory, missing of patches Microsoft anti-virus status, safety criteria and displays the results in your Web browser. All of your PC profile information is kept private on your PC and is not sent to any web server.
- Operating systems: runs on Windows 7, 2008 R2, Vista, 2008, 2003, XP, 2000, NT 4, Me, 98 and 95. 32-bit and 64-bit Windows are supported.
- Browsers: works on Internet Explorer, Firefox, Safari, Opera and many others.
- File size: 3062 KB.
- License: the license associated with this product allows for free personal use. Use on multiple computers in a business, educational, military or Government facility is prohibited. See the license agreement for more details.
DOWNLOAD TIPS:- Click the click here to download .
- Click run in the file download of Internet Explorer pop up.
- Belarc Advisor automatically install, build a profile of your hardware and software and display in your Web browser.
-
This sentence is the last thing on my list of contacts and appears only when I use the contacts list to send an email.
I don't know how to remove and how it get there in the first place. I can delete it at the time, however, it
y at - it next time. I can't click on it and there is no address attached.
Can you help me? IT IS SAID HORNEY GIRL HERE
BEA Harrison
Hello
you say not what e-mail program, you use
you use Hotmail?
I'm sorry, but we cannot help with hotmail problems in these forums in response to vista
Please repost your question in hotmail in the hotmail link below forums
http://windowslivehelp.com/product.aspx?ProductID=1
ForumsConsult with Microsoft Certified Solutions -
How Adobe gets DATE and its format?
Hello
I'm current date (today) to below JS in some flds and below using FormCalc for some flds in my_form;
JS:
var currentTime = new Date()
Form Calc:
$.rawValue = num2date (date (), DateFmt(MM/DD/YYYY))
But I have not much idea how adobe is at that date? For my business it is the first form, that's why they ask me how adobe gets so, date format and its
1) count local address IP/Internet provider, format?
(2) or PREMISES of the portable PC/computer user settings, date format? If Yes, for example, if the user (the laptop settings) Germany has a DD. MM YYYY configured, if this user is delivered to the United States on a business trip and if the user opens the form, and then how the date looks like for this user? Depending on the settings of computer laptop user JJ. MM YYYY or local internship provider date format MM/DD/YYYY?
Thank you
Go to PDF... No!
-
Retriving data by joining several tables and total general
Hello PL/SQL gurus and experts.
I use Oracle Database 11 g Enterprise Edition Release 11.2.0.1.0 - 64-bit Production version
I have table-
I have the following three tablesDROP TABLE Person_Tb; create table Person_Tb(Person_ID,Person_FName,Person_LName) as select 1001, 'Nikki','Carlos' from dual union all select 1002, 'Nina', 'Harrison' from DUAL union all select 1003, 'Mike', 'Carwely' from dual union all select 1004, 'Michael', 'Robinson' from DUAL union all select 1005, 'Hendi', 'Klum' from dual union all select 1006, 'Robert', 'Regan' from dual union all select 1007, 'Maria', 'Washington' from dual union all select 1008, 'Kistrien', 'Obama' from dual union all select 1009, 'Andrew', 'Regan' from dual union all select 1010, 'Emma', 'Thomsan' from dual union all select 1011, 'Andy', 'Grant' from dual union all select 1012, 'Brandy', 'Decosta' from dual;
DROP TABLE Teacher; create table Teacher(Teacher_ID,Fee_Date,Account_ID) as select 1001, '04/04/2013',3004 from dual union all select 1002, '04/06/2013',3006 from DUAL union all select 1003, '04/08/2013',3014 from dual union all select 1004, '04/08/2013',3017 from DUAL union all select 1005, '04/09/2013',3019 from dual union all select 1011, '04/12/2013',3025 from dual union all select 1012, '04/12/2013',3046 from DUAL;
I am able to recover the data individually Tracher and student as -.DROP TABLE Student; create table Student(Student_ID,Subaccount_ID) as select 1006,3004 from dual union all select 1007,3006 from DUAL union all select 1008,3004 from dual union all select 1009,3017 from DUAL union all select 1010,3017 from dual;
Select distinct pt.Person_LName || ',' || pt.Person_FName Trdr_NM from Student st, person_Tb pt where st.Student_id = pt.PERSON_ID
I need to get the records for all teachers who are associated with students-Select distinct pt.Person_LName || ',' || pt.Person_FName SubAct_Invst from Teacher tc, person_Tb pt where tc.teacher_id = pt.PERSON_ID
But how to retrieve the data above format, many want to help. Thanks in advance and I really appericate your time and efforts.SubAct_Invst Trdr_NM ---------------------------------------------------- Carlos,Nikki Regan,Robert Obama,Kistrien Harrison,Nina Washington,Maria Carwely,Mike Robinson,Michael Regan,Andrew Thomsan,Emma Klum,Hendi Grant,Andy Decosta,Brandy ------------------------------------------------------ Grand Total 7 5
Ideally, your condition must be handled by a front-end tool...
If you need specifically using SQL, you can check my previous post...
-
Requirement of Beeping - how to get subtotals for each combination of 2 columns val
Hi gurus, Experts and all,.
Help me please with my reporting requirement, on how to code this in PIF. Thank you.
Requirement: I need to get the subtotals for each value of the combination of two columns.
Columns example: team group AMOUNT
Sample column values: placed Team1 100
Group b... Team2... 200
GroupA - Team1 Subtotals = 500 (value of the sample only)
GroupA - Team2 Subtotals = 400 (value of the sample only)
Group b - Team1 Subtotals = 600 (value of the sample only)
Group b - Team2 Subtotals = 200 (value of the sample only)
GrandTotal = 1700
Thank you.
Jean Paul
BEEP newbie
Published by: user10955574 on October 28, 2010 05:40- -
output for data
GROUPA - TEAM1 - 200 GROUPB - TEAM1 - 300 GROUPC - TEAM2 - 400 GROUPD - TEAM2 - 500 GROUPA - TEAM3 - 600 GROUPB - TEAM3 - 700 GROUPC - TEAM4 - 800 GROUPD - TEAM4 - 900 GROUPA - TEAM5 - 1000
-
How to get latitude and longitude from a specific location
Hi, we can get card giving the latitude and longitude. But I need to get the card when I give the specific location, like New York etc.. So how do you get the particular location points. I use the 8820 Simulator in eJDE4.5.
can someone help me solve this problem.
Thank you
There
integer
Latitude in decimal degrees x 100,000x
integer
longitude in decimal degrees x 100,000See GPS and BlackBerry Maps Development Guide.pdf
-
Report show no subtotals and Total per report
Hello
I'm new in OBIEE reporting.
I created a simple test with accuracy of invoices of purchases and have added fileds for the period accounting, seller name, amount of the invoice, Bill Source
But when I checked the function sum for the period, the seller and the report is now displayed the total in the region of the table of the report
Please help solve
Concerning
SS
HII,
I think that, you hav not taken any measure that applied the rule of the aggregation... If you wnt grand total for amount of the invoice follow these steps:
analysis of Edit--> symbol warning CLICK in the columns and measures--> select after-->, then right-click on the amount of the invoice--> aggregation column select rule (SUM)--> ok
u wil get the expected results.
Check if got the answer...
-
How to get to the total/sum at the end of the production
How can I get an output like below using SQL statements only;
ENAME SAL
------------ ---
SMITH, 800
KING 5000
ADAMS 1100
Total 6900
Best regards, YacoubSELECT ENAME , Sal FROM EMP UNION SELECT 'TOTAL' A , SUM(Sal) FROM EMP GROUP BY 'TOTAL'
Published by: AJ99 on July 6, 2009 14:57
-
How to get documents and data to the cloud on my Mac desktop?
After the upgrade to Sierra all my data (documents and desktop) have been transferred to Icloud. I absolutely not want all my data on another server costs me more money. How do I lose all my data safely back on my Mac, without anything? I'm quite t... o... that the decisions of this importance are make with a single click (or without?). Preferably, I do not want to export every file (of the thousands...) by hand, but just change things back to where it was before.
Thanks in advance!
Documents are also in your folder on the drive on your Mac iCloud.
Just disable iCloud drive in iCloud preferences.
Then go icloud.com and connect, then you remove the files on disc to iCloud.
8. how to disable iCloud drive?
To disable iCloud Drive on your iOS device, go to settings > iCloud > iCloud driveand on your Mac, go to the Apple menu > System Preferences > iCloud. If you disable iCloud drive, so you you will manage your files locally, documents are not synchronized or updated your iOS iOS devices 8 or OS X Yosemite or iCloud.com.
-
Dear _____,
The tag below appears on every email that I send out-'PK' means nothing to me, and I don't know how it got there.
--
PKMy first thought is: you put in place a signature? Thunderbird will add your signature to each outgoing message. It's on a form where you can easily type a few characters inadvertently. More info in this article: Signatures.
Was she?
-
How to get photos and videos from mobile phone Satellite L450D-128
Hello
I have a series of Satellite/Satellite L450D/Satellite L450D-128 and I'm a bit thick, I also have a samsung 5600 that I want to get the photos/videos-I tried to connect my phonebut he could not connect the driver and seemed to have a lot of problems.
I thought maybe I could bluetooth of my phone to my lap top but don't think that it has blue tooth? Does? and if she can't?
Hello
I Don t know exactly if this laptop has bluetooth.
In any case, you can buy a "USB Bluetooth adapter" (PA3710E-1BTM). It costs about 10-.
It will be recognized to the BONE and you don t need any other drivers.Best regards
-
How to get Contacts and calendars after signing to iCloud
I want to disconnect from the iCloud because it messes up my Mail and other programs when it is on, but when I do, it deletes my Contacts and calendars from my Mac (how rude it is?). How can I disconnect from iCloud and still not my Contacts and calendars on my Mac?
Turn off sync first to iCloud system preferences and keep when you are prompted.
-
How to get higher and second higher value of a line?
Hello world
I want more solid and second upper sal from emp in a line,
Thank youHello
Whenever you have a problem, after the results you want.
Always tell what version of Oracle you are using.Are you looking for this?
HIGHEST_SAL SECOND_HIGHEST_SAL ----------- ------------------ 5000 3000
If so, follow these steps:
WITH got_r_num AS ( SELECT sal , ROW_NUMBER () OVER (ORDER BY sal DESC) AS r_num FROM scott.emp ) SELECT MAX (CASE WHEN r_num = 1 THEN sal END) AS highest_sal , MAX (CASE WHEN r_num = 2 THEN sal END) AS second_highest_sal FROM got_r_num ;
It works in Oracle 9 (and), but can easily be adapted for Oracle 8.1.
From Oracle 11, you can also use SELECT... PIVOT.It is unclear how you want to handle links. Say there were only 3 rows, with 100, 200 and 200 sals. What do you consider being the second highest?
-
How to get smooth and straight zoom-in?
I want to zoom-in on still images in a video with a good early speed, not instantly sudden movement.
However, when I use mitigate or Bézier curves of Position and/or speed of the scale, the path of the zoom to changing its target.
In other words, instead of a smooth start with a zoom-in on a straight line, the camera' turns left, to the right, upwards or downwards.
I was not able to find anyone else having this problem, but the discount is even worse than abrupt jerks speed. So I can not just use these features needed for professional quality video.
Thanks for any help that anyone can give!
Well, the problem is that you have an ease on your balance, but not your position - so, scale is a little behind the position. If you add an ease out on the (first) Position key frame, the animation between the two should be more in phase.
Maybe you are looking for
-
I have used Firefox for years, about a week before Christmas, I tried to use the sky go for the 1st time in 6 to 8 weeks and it wouldn't work. It was as if there was no player at all - no buffering, no error message, just a white box where the player
-
How to avoid connecting them to Firefox whenever I open it?
Firefox used to be signed whenever I opened it. Now it forces me to go through the entire Panel, including the password whenever I start it. How do you stay connected? When I connect, it goes to my correct home page. I just signed each time.
-
How to print emails from my Ipad on an HP6500. Can print attachments
I followed the instructions on the bottom of the post. I can print the attachments very well, but I can't print the text of the e-mail. What should I do?
-
How can I re - install Windows Vista without the media?
machine will not start in vista I have a gateway W34DUA with windows vista it will not load vista how do you get the thing to reinstall without a disk I'm thinking it was pre loaded or can I get a disc and use the product key from the back and reinst
-
Windows stops working when you try to use Windows Search
Original title : stop windows When I try to use windows search, windows stops always working.