473,396 Members | 1,968 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Need help on using analytical function

Hi ,

Please help me with this ..

I have a HEALTHISSUE_AUDIT table which looks like this :

UPDATEDATE ISSUEID HEALTHINDEX
1-Mar-08 1 5
1-Mar-08 2 6
2-Mar-08 1 7
2-Mar-08 3 9
3-Mar-08 2 8
5-Mar-08 4 2

I need to get a cumulative sum of the latest value of HEALTHINDEX column per UPDATEDATE.The cumulative sum per UPDATEDATE shud
1)contain the HEALTHINDEX values ( which is tied to a ISSUEID) for that UPDATEDATE
2)contain the HEALTHINDEX values , for UPDATEDATE lesser than the current UPDATEDATE
3)But , if a ISSUEID has already been considered as in point 1, and the same ISSUEID is present in the lesser UPDATEDATE , the cumulative sum must not include this value of HEALTHINDEX , ie , only the latest value of HEALTHINDEX per ISSUEID shud be considered per UPDATEDATE .

I googled and managed to frame a query like :
Expand|Select|Wrap|Line Numbers
  1. select UPDATEDATE,SUM(SUM(HEALTH_INDEX)) OVER (ORDER BY UPDATEDATE ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS cumulative_sum from HEALTHISSUE_AUDIT where ISSUEID IN (1,2,3,4) GROUP BY UPDATEDATE ORDER BY UPDATEDATE
  2.  
But , this query , also adds , in the cumulative sum the HEALTHINDEX for a repeating ISSUEID.

Is there a way to not add the duplicate ISSUEID ?

Thanks in advance
Mar 27 '08 #1
1 1190
amitpatel66
2,367 Expert 2GB
Can you please post the sample output that you got when you executed the above query?
Mar 27 '08 #2

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

Similar topics

0
by: elena | last post by:
I have a test online that measures cognitive style. It determines whether the participant has an intuitive or analytical learning style. It takes about 5 minutes. It's here: http://www.elena.com...
10
by: Jeff Wagner | last post by:
I am in the process of learning Python (obsessively so). I've been through a few tutorials and read a Python book that was lent to me. I am now trying to put what I've learned to use by rewriting...
19
by: Atif | last post by:
Hello all, In my html page I want to add an image say of 800x600. Now I want that when ever I am given two coordinates on this image say (x1, y1)=(50, 100) and (x2, y2)=(200, 300), the java script...
15
by: drdoubt | last post by:
using namespace std In my C++ program, even after applying , I need to use the std namespace with the scope resolution operator, like, std::cout, std::vector. This I found a little bit...
7
by: angelasg | last post by:
Here is sample data I'm working with: ID ShiftDate SegTime 99 5/2/2005 5/2/2005 1:00:00 PM 99 5/2/2005 5/2/2005 1:04:00 PM 99 5/2/2005 5/2/2005 1:43:00 PM 99 5/2/2005...
10
by: Scott | last post by:
I have written an Access application that our employees use on a daily basis to enter information. It's comprises of a series of forms, a few data integrity check queries that run in the...
9
by: Algonquin J. Calhoun | last post by:
I've developed an application that exceeds the Access 2GB limit. This application was developed as a prototype and the users have found it very useful. Approximately 45,000 records are added to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
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,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...

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.