<?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/"
		>
<channel>
	<title>Comments on: Aggregating Data With The OVER Clause</title>
	<atom:link href="http://blog.hoegaerden.be/2010/06/01/aggregating-data-with-the-over-clause/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.hoegaerden.be/2010/06/01/aggregating-data-with-the-over-clause/</link>
	<description>SQL Server, BI, .NET, IT and anything else I have been playing with.</description>
	<lastBuildDate>Wed, 08 Feb 2012 16:00:45 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
	<item>
		<title>By: Valentino Vranken</title>
		<link>http://blog.hoegaerden.be/2010/06/01/aggregating-data-with-the-over-clause/comment-page-1/#comment-2616</link>
		<dc:creator>Valentino Vranken</dc:creator>
		<pubDate>Sat, 12 Jun 2010 12:28:11 +0000</pubDate>
		<guid isPermaLink="false">http://blog.hoegaerden.be/2010/06/01/aggregating-data-with-the-over-clause/#comment-2616</guid>
		<description>I&#039;m glad that my posts have proven to be useful, that&#039;s what I&#039;m doing it for!  Whenever you feel like contributing again, don&#039;t hesitate ;-)

Enjoy the weekend,
Valentino.</description>
		<content:encoded><![CDATA[<p>I&#8217;m glad that my posts have proven to be useful, that&#8217;s what I&#8217;m doing it for!  Whenever you feel like contributing again, don&#8217;t hesitate <img src='http://blog.hoegaerden.be/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>Enjoy the weekend,<br />
Valentino.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Paul</title>
		<link>http://blog.hoegaerden.be/2010/06/01/aggregating-data-with-the-over-clause/comment-page-1/#comment-2608</link>
		<dc:creator>Paul</dc:creator>
		<pubDate>Fri, 11 Jun 2010 00:37:59 +0000</pubDate>
		<guid isPermaLink="false">http://blog.hoegaerden.be/2010/06/01/aggregating-data-with-the-over-clause/#comment-2608</guid>
		<description>Thank you for the update.  I&#039;ve learned so much from your blog posts, I&#039;m delighted to have contributed in a small way.

Best wishes,
Paul</description>
		<content:encoded><![CDATA[<p>Thank you for the update.  I&#8217;ve learned so much from your blog posts, I&#8217;m delighted to have contributed in a small way.</p>
<p>Best wishes,<br />
Paul</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Valentino Vranken</title>
		<link>http://blog.hoegaerden.be/2010/06/01/aggregating-data-with-the-over-clause/comment-page-1/#comment-2607</link>
		<dc:creator>Valentino Vranken</dc:creator>
		<pubDate>Thu, 10 Jun 2010 18:23:06 +0000</pubDate>
		<guid isPermaLink="false">http://blog.hoegaerden.be/2010/06/01/aggregating-data-with-the-over-clause/#comment-2607</guid>
		<description>I have now continued the story by adding the even more simplified OVER clause, thanks again for making me investigate the complete syntax!

Valentino.</description>
		<content:encoded><![CDATA[<p>I have now continued the story by adding the even more simplified OVER clause, thanks again for making me investigate the complete syntax!</p>
<p>Valentino.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Valentino Vranken</title>
		<link>http://blog.hoegaerden.be/2010/06/01/aggregating-data-with-the-over-clause/comment-page-1/#comment-2599</link>
		<dc:creator>Valentino Vranken</dc:creator>
		<pubDate>Wed, 09 Jun 2010 20:23:13 +0000</pubDate>
		<guid isPermaLink="false">http://blog.hoegaerden.be/2010/06/01/aggregating-data-with-the-over-clause/#comment-2599</guid>
		<description>Hi Paul,

The way you&#039;ve presented it won&#039;t work, because that would result in the regular error when retrieving fields that are not included in an aggregate or group by...
But you&#039;ve made me curious so I had a closer look at the OVER Clause syntax in the BOL.  Seems that the PARTITION BY is actually optional and when omitted it will perform the aggregate function over the whole dataset.  So the following will work just fine:

    AVG(SalesLastYear) OVER () SalesLastYear_AVG,
    SUM(SalesLastYear) OVER () SalesLastYear_SUM

Thanks for an interesting question!

Regards,
Valentino.</description>
		<content:encoded><![CDATA[<p>Hi Paul,</p>
<p>The way you&#8217;ve presented it won&#8217;t work, because that would result in the regular error when retrieving fields that are not included in an aggregate or group by&#8230;<br />
But you&#8217;ve made me curious so I had a closer look at the OVER Clause syntax in the BOL.  Seems that the PARTITION BY is actually optional and when omitted it will perform the aggregate function over the whole dataset.  So the following will work just fine:</p>
<p>    AVG(SalesLastYear) OVER () SalesLastYear_AVG,<br />
    SUM(SalesLastYear) OVER () SalesLastYear_SUM</p>
<p>Thanks for an interesting question!</p>
<p>Regards,<br />
Valentino.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Paul</title>
		<link>http://blog.hoegaerden.be/2010/06/01/aggregating-data-with-the-over-clause/comment-page-1/#comment-2594</link>
		<dc:creator>Paul</dc:creator>
		<pubDate>Tue, 08 Jun 2010 12:05:49 +0000</pubDate>
		<guid isPermaLink="false">http://blog.hoegaerden.be/2010/06/01/aggregating-data-with-the-over-clause/#comment-2594</guid>
		<description>Great!  Thank you for posting.

One question - can you just omit the over / partition by when using a constant to partition?  In your last example, would

AVG(SalesLasYear) SalesLastYear_AVG,
SUM(SalesLastYear) SalesLastYear_SUM

work just as well?</description>
		<content:encoded><![CDATA[<p>Great!  Thank you for posting.</p>
<p>One question &#8211; can you just omit the over / partition by when using a constant to partition?  In your last example, would</p>
<p>AVG(SalesLasYear) SalesLastYear_AVG,<br />
SUM(SalesLastYear) SalesLastYear_SUM</p>
<p>work just as well?</p>
]]></content:encoded>
	</item>
</channel>
</rss>

