473,606 Members | 2,885 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Reporting Function

debasisdas
8,127 Recognized Expert Expert
REPORTING FUNCTIONS ALLOW THE EXECUTION OF VARIOUS AGGREGATE FUNCTIONS AGAINST A RESULT SET.UNLIKE WINDOWING FUNCTIONS THESE CAN'T SPECIFY LOCALISED WINDOWS AND THUS GENERATE THE SAME RESULT FOR EACH ENTIRE PARTITION.REPOR TING FUNCTION GENERATES SAME RESULT AS A WINDOWING FUNCTION WITH AN UNBOUNDED WINDOW.
Sample Ex#1
-------------------------
Expand|Select|Wrap|Line Numbers
  1. SELECT HIREDATE,SUM(SAL) "SALARY",SUM(SUM(SAL)) OVER (ORDER BY HIREDATE ROWS BETWEEN
  2. UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) "TOTALSALARY" 
  3. FROM EMP 
  4. GROUP BY HIREDATE 
  5. ORDER BY HIREDATE;
Sample Ex#2
-------------------------
Expand|Select|Wrap|Line Numbers
  1. SELECT HIREDATE,
  2. SUM(SAL) "SALARY",
  3. SUM(SUM(SAL)) OVER (ORDER BY HIREDATE ROWS BETWEEN
  4. UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) "WINDOWSALARY" ,
  5. SUM(SUM(SAL)) OVER() "REPORTINGSALES"
  6. FROM EMP GROUP BY HIREDATE ORDER BY HIREDATE;
THE EMPTY PARENTHESES AFTER THE OVER CLAUSE FOR THE COLUMN INDICATES THAT THE ENTIRE RESULTSET SHOULD BE INCLUDED IN THE SUM,WHICH HAS SAME EFFECT AS USING AN UNBOUNDED WINDOW FUNCTION.REPORT ING FUNCTIONS ARE USEFUL WHEN BOTH DETAIL AND AGGREGATE DATA IS REQUIRED.

Sample Example #3
=============== ===

Expand|Select|Wrap|Line Numbers
  1. SELECT HIREDATE,SUM(SAL) "SALARY",
  2. SUM(SUM(SAL)) OVER() "REPORTINGSALES"
  3. FROM EMP
  4. WHERE JOB='MANAGER'
  5. GROUP BY HIREDATE ORDER BY HIREDATE;
LIKE RANKING FUNCTIONS,REPOR TING FUNCTIONS CAN ALSO INCLUDE PARTITION BY CLAUSE TO SPLIT THE RESULT SET INTO MULTIPLE PIECES,ALLOWING MULTIPLE AGGREGATIONS TO BE COMPUTED ACCROSS DIFFERENT SUBSETS OF THE RESULT SET.

Sample Example #4
=============== ===

Expand|Select|Wrap|Line Numbers
  1. SELECT DEPTNO,EMPNO,SUM(SAL)"SALARY",SUM(SUM(SAL)) OVER(PARTITION BY DEPTNO) "DEPTSAL"
  2. FROM EMP
  3. GROUP BY DEPTNO,EMPNO
  4. ORDER BY DEPTNO,EMPNO
  5.  
RATIO_TO_REPORT
---------------------------------------
Sample Ex#5
=============
Expand|Select|Wrap|Line Numbers
  1. SELECT DEPTNO,
  2.  EMPNO,
  3.  SUM(SAL)"SALARY",
  4.  ROUND(SUM(SAL)/SUM(SUM(SAL)) OVER(PARTITION BY DEPTNO),2) "DEPTPERCENT"
  5.  FROM EMP
  6.  GROUP BY DEPTNO,EMPNO
  7.  ORDER BY DEPTNO,EMPNO;

Sample Ex#6
=============
Expand|Select|Wrap|Line Numbers
  1. SELECT DEPTNO,
  2. EMPNO,
  3. SUM(SAL)"SALARY",
  4. ROUND(RATIO_TO_REPORT(SUM(SAL)) OVER(PARTITION BY DEPTNO),2) "DEPTRATIO"
  5. FROM EMP
  6. GROUP BY DEPTNO,EMPNO
  7. ORDER BY DEPTNO,EMPNO;
Jul 13 '07 #1
0 4635

Sign in to post your reply or Sign up for a free account.

Similar topics

5
2041
by: steve | last post by:
Hi, In my script (phpnuke), whenever there is access to database, there is this line of code: message_die(GENERAL_ERROR, ’some error msg’, ’’, __LINE__, __FILE__, $sql); Is there a more elegant way of reporting line number besides putting this line everywhere I access db. I want to just write a function, which also globally knows about the current line number(?) and in case
8
2738
by: Woody Splawn | last post by:
I am asking this question here because I asked this question in the Reporting Services Newsgroup and did not get an answer. Does anyone know if Reporting Services is intended to work in a client/Server or Local machine environment? Based on what I have seen my guess is yes but that is a guess. In some materal it talks about it running on a web server but my supposition is that this does not necessarily mean that it would not make for a...
0
2638
by: Joshua V. | last post by:
We are trying to implement Windows Error Reporting from within our VB.Net application. Basically we want to replace the standard unhandled exception message we use with the Windows Error Reporting message. This will provide our users the ability to send the crash report to Microsoft, which in turn will allow us to get it. We did a search for Visual Studio help to see what that might turn up and came across the “ReportFault”...
2
8188
by: Martin Widmer | last post by:
Hi guys I am looking for the best way to generate new reports with reporting services for SQL server 2005. The reports will be generated programmatically from a .Net VB application. So far I see the only way to do it is to feature my objects (text blocks, pictures, tables drawn from excel and databases etc.) with a "render to RDL"- function and thus create an RDL definition of the report, then push that one to the server using the...
2
5314
by: RdS | last post by:
Hello, I use sourcesafe and vb 2003 for my dev environment. on the sourcesafe server I also have sql2005 and reporting services installed. The web app references this sql server for db. When I compile the app on my local machine which is used for development I am able to lauch application with no problem. When I run my web app on my local machine which uses my IIS 5 (WinXP Pro) the application runs fine. But if I connect to server...
0
2253
by: YellowFin Announcements | last post by:
Whitepaper: "Yellowfin Reporting" enables Embedded Business Intelligence -------------------------------------------------------------------------------- Embedded reports are a standard requirement of most applications. But users are increasingly demanding more sophisticated reporting from applications - seeking such features as custom report design, ad hoc report creation and analytics. Developers that want to embed business...
2
1968
by: petermichaux | last post by:
Hi, It seems like determining element position in a web page is a difficult task. In the position reporting source code I've looked at there are special fixes for at least some versions of Safari and Opera. I am doing a lot of dragdrop experimentation and in some situations need a position reporting function. The function doesn't need to report the positions of exotic elements like images in button elements; however, I would like a...
8
5014
by: Paul Furman | last post by:
How do I turn off MySQL error reporting? I set error_reporting(0); but that doesn't seem to be working.
0
4753
by: Dan.Diasio | last post by:
Recently I moved from Crystal reports to the Reporting Services module. In Crystal, I was able to use the TOP N function to report only the top 15 customers in a particular query, and aggregate the rest of the customers into an "All Others" category. With reporting services, I've created teh same top 15 using TOP N in the filter tab in reporting services - however, I'm unable to find an easy way to aggregate the rest into the "All...
0
7962
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8456
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8443
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
6792
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5467
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3945
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2452
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1565
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1309
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.