Newsgroups: comp.databases.oracle.misc
From: Geoff Muldoon <geoff.muld...@trap.gmail.com>
Date: Wed, 16 Nov 2011 09:49:54 +1100
Local: Tues, Nov 15 2011 5:49 pm
Subject: Re: Multiple use of RANK analytic in a single query
hooperc2...@yahoo.com says...
> > I'm a novice in using the RANK analytical function, struggling with Eureka. the > > basic syntax of it let alone trying to figure out if what I'm trying to > > achieve is possible, maybe even using subqueries ... > I think that what needs to be done is to build the solution in > stages. First, let's calculate the SUM values for the rows - I took a > best guess at the partition clause using the raw data that you > provided and the expected output: > SUM(LOAD) OVER (PARTITION BY ID,DEPT) SUM_LOAD_ID, > SUM(LOAD) OVER (PARTITION BY ID,LOCATION) SUM_LOAD_LOCATION, Thank you Charles, that partitioned summing in a subquery was just the IOU big time.
> Are you able to provide a sample table with data for your real-ish
Working example:
> code? It is difficult to determine the original data values from the > two output examples that you provided. CREATE TABLE test_table (load_year NUMBER, person_id VARCHAR2(5), INSERT INTO test_table (load_year, person_id, org_code, class_code, INSERT INTO test_table (load_year, person_id, org_code, class_code, INSERT INTO test_table (load_year, person_id, org_code, class_code, INSERT INTO test_table (load_year, person_id, org_code, class_code, INSERT INTO test_table (load_year, person_id, org_code, class_code, INSERT INTO test_table (load_year, person_id, org_code, class_code, INSERT INTO test_table (load_year, person_id, org_code, class_code, SELECT LOAD_YEAR PERSON_ID ORG_CODE ORG_RANK CLASS_CODE CLASS_RANK LOAD_VALUE
Perfecto!
Geoff
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||