<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: Matching the Expected Output &#8211; Analytic RANK, ROW_NUMBER, DENSE_RANK, or Something Different?</title>
	<atom:link href="http://hoopercharles.wordpress.com/2011/11/16/matching-the-expected-output-analytic-rank-row_number-dense_rank-or-something-different/feed/" rel="self" type="application/rss+xml" />
	<link>http://hoopercharles.wordpress.com/2011/11/16/matching-the-expected-output-analytic-rank-row_number-dense_rank-or-something-different/</link>
	<description>Miscellaneous Random Oracle Topics: Stop, Think, ... Understand</description>
	<lastBuildDate>Thu, 23 May 2013 04:02:42 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: Sid</title>
		<link>http://hoopercharles.wordpress.com/2011/11/16/matching-the-expected-output-analytic-rank-row_number-dense_rank-or-something-different/#comment-4079</link>
		<dc:creator><![CDATA[Sid]]></dc:creator>
		<pubDate>Fri, 18 Nov 2011 15:40:17 +0000</pubDate>
		<guid isPermaLink="false">http://hoopercharles.wordpress.com/?p=5618#comment-4079</guid>
		<description><![CDATA[hi Charles,

Nice example!
for the part 2, to make it easy, 4 rows in the staff_load is enough to show the recursive analytic function usage. Here comes my example(not sure how to format the code in the comment)
1
&lt;pre&gt;
oe@CS10G&gt; drop table STAFF_LOAD purge;

Table dropped.

oe@CS10G&gt; create table STAFF_LOAD
  2  (
  3  load_year number,
  4  org_unit_code varchar2(10),
  5  classif_code varchar2(10),
  6  fte_days number
  7  );

Table created.

oe@CS10G&gt; 
oe@CS10G&gt; pause;
&lt;/pre&gt;
&lt;pre&gt;
oe@CS10G&gt; insert into staff_load values(2010,&#039;A46&#039;,&#039;HEW3&#039;,59);

1 row created.

oe@CS10G&gt; insert into staff_load values(2010,&#039;A42&#039;,&#039;HEW3&#039;,13);

1 row created.

oe@CS10G&gt; insert into staff_load values(2010,&#039;A42&#039;,&#039;HEW4&#039;,13);

1 row created.

oe@CS10G&gt; insert into staff_load values(2010,&#039;A46&#039;,&#039;HEW4&#039;,12);

1 row created.

oe@CS10G&gt; commit ;

Commit complete.

oe@CS10G&gt; 
oe@CS10G&gt; pause;
&lt;/pre&gt;
&lt;pre&gt; 
oe@CS10G&gt; SELECT
  2    LOAD_YEAR,
  3    ORG_UNIT_CODE,
  4    --ORG_SUM,
  5    DENSE_RANK() OVER (PARTITION BY LOAD_YEAR ORDER BY ORG_SUM DESC) ORG_RANK,
  6    CLASSIF_CODE,
  7    --CLASSIF_SUM,
  8    DENSE_RANK() OVER (PARTITION BY LOAD_YEAR ORDER BY CLASSIF_SUM DESC) CLASSIF_RANK,
  9    FTE
 10  FROM
 11  (
 12  SELECT
 13    LOAD_YEAR,
 14    ORG_UNIT_CODE,
 15    SUM(SUM(FTE_DAYS)) OVER (PARTITION BY LOAD_YEAR, ORG_UNIT_CODE) ORG_SUM,
 16    CLASSIF_CODE,
 17    SUM(SUM(FTE_DAYS)) OVER (PARTITION BY LOAD_YEAR, CLASSIF_CODE) CLASSIF_SUM,
 18    SUM (FTE_DAYS) FTE
 19  FROM
 20    STAFF_LOAD
 21  GROUP BY
 22    LOAD_YEAR,
 23    ORG_UNIT_CODE,
 24    CLASSIF_CODE)
 25  order by FTE desc, org_unit_code asc
 26  ;

 LOAD_YEAR ORG_UNIT_C	ORG_RANK CLASSIF_CO CLASSIF_RANK	FTE
---------- ---------- ---------- ---------- ------------ ----------
      2010 A46		       1 HEW3		       1	 59
      2010 A42		       2 HEW3		       1	 13
      2010 A42		       2 HEW4		       2	 13
      2010 A46		       1 HEW4		       2	 12
&lt;/pre&gt;]]></description>
		<content:encoded><![CDATA[<p>hi Charles,</p>
<p>Nice example!<br />
for the part 2, to make it easy, 4 rows in the staff_load is enough to show the recursive analytic function usage. Here comes my example(not sure how to format the code in the comment)<br />
1</p>
<pre>
oe@CS10G&gt; drop table STAFF_LOAD purge;

Table dropped.

oe@CS10G&gt; create table STAFF_LOAD
  2  (
  3  load_year number,
  4  org_unit_code varchar2(10),
  5  classif_code varchar2(10),
  6  fte_days number
  7  );

Table created.

oe@CS10G&gt; 
oe@CS10G&gt; pause;
</pre>
<pre>
oe@CS10G&gt; insert into staff_load values(2010,'A46','HEW3',59);

1 row created.

oe@CS10G&gt; insert into staff_load values(2010,'A42','HEW3',13);

1 row created.

oe@CS10G&gt; insert into staff_load values(2010,'A42','HEW4',13);

1 row created.

oe@CS10G&gt; insert into staff_load values(2010,'A46','HEW4',12);

1 row created.

oe@CS10G&gt; commit ;

Commit complete.

oe@CS10G&gt; 
oe@CS10G&gt; pause;
</pre>
<pre> 
oe@CS10G&gt; SELECT
  2    LOAD_YEAR,
  3    ORG_UNIT_CODE,
  4    --ORG_SUM,
  5    DENSE_RANK() OVER (PARTITION BY LOAD_YEAR ORDER BY ORG_SUM DESC) ORG_RANK,
  6    CLASSIF_CODE,
  7    --CLASSIF_SUM,
  8    DENSE_RANK() OVER (PARTITION BY LOAD_YEAR ORDER BY CLASSIF_SUM DESC) CLASSIF_RANK,
  9    FTE
 10  FROM
 11  (
 12  SELECT
 13    LOAD_YEAR,
 14    ORG_UNIT_CODE,
 15    SUM(SUM(FTE_DAYS)) OVER (PARTITION BY LOAD_YEAR, ORG_UNIT_CODE) ORG_SUM,
 16    CLASSIF_CODE,
 17    SUM(SUM(FTE_DAYS)) OVER (PARTITION BY LOAD_YEAR, CLASSIF_CODE) CLASSIF_SUM,
 18    SUM (FTE_DAYS) FTE
 19  FROM
 20    STAFF_LOAD
 21  GROUP BY
 22    LOAD_YEAR,
 23    ORG_UNIT_CODE,
 24    CLASSIF_CODE)
 25  order by FTE desc, org_unit_code asc
 26  ;

 LOAD_YEAR ORG_UNIT_C	ORG_RANK CLASSIF_CO CLASSIF_RANK	FTE
---------- ---------- ---------- ---------- ------------ ----------
      2010 A46		       1 HEW3		       1	 59
      2010 A42		       2 HEW3		       1	 13
      2010 A42		       2 HEW4		       2	 13
      2010 A46		       1 HEW4		       2	 12
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Log Buffer #246, A Carnival of the Vanities for DBAs &#124; The Pythian Blog</title>
		<link>http://hoopercharles.wordpress.com/2011/11/16/matching-the-expected-output-analytic-rank-row_number-dense_rank-or-something-different/#comment-4077</link>
		<dc:creator><![CDATA[Log Buffer #246, A Carnival of the Vanities for DBAs &#124; The Pythian Blog]]></dc:creator>
		<pubDate>Fri, 18 Nov 2011 12:01:26 +0000</pubDate>
		<guid isPermaLink="false">http://hoopercharles.wordpress.com/?p=5618#comment-4077</guid>
		<description><![CDATA[[...] Charles Hooper blogs about matching the expected output – Analytic RANK, ROW_NUMBER, DENSE_RANK, or Something Different? [...]]]></description>
		<content:encoded><![CDATA[<p>[...] Charles Hooper blogs about matching the expected output – Analytic RANK, ROW_NUMBER, DENSE_RANK, or Something Different? [...]</p>
]]></content:encoded>
	</item>
</channel>
</rss>
