<?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: Attribute summing in CRM entity hierarchies</title>
	<atom:link href="http://friism.com/attribute-summing-in-crm-entity-hierarchies/feed" rel="self" type="application/rss+xml" />
	<link>http://friism.com/attribute-summing-in-crm-entity-hierarchies</link>
	<description>a Michael Friis production</description>
	<lastBuildDate>Wed, 18 Aug 2010 01:59:39 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: immankSem</title>
		<link>http://friism.com/attribute-summing-in-crm-entity-hierarchies/comment-page-1#comment-1228</link>
		<dc:creator>immankSem</dc:creator>
		<pubDate>Fri, 24 Apr 2009 14:43:39 +0000</pubDate>
		<guid isPermaLink="false">http://www.itu.dk/~friism/blog/?p=15#comment-1228</guid>
		<description>hm... thanks :)</description>
		<content:encoded><![CDATA[<p>hm&#8230; thanks <img src='http://friism.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Randoom &#8211; Techniques for unique, correct and fast geo-queries II</title>
		<link>http://friism.com/attribute-summing-in-crm-entity-hierarchies/comment-page-1#comment-1143</link>
		<dc:creator>Randoom &#8211; Techniques for unique, correct and fast geo-queries II</dc:creator>
		<pubDate>Tue, 27 Jan 2009 20:59:59 +0000</pubDate>
		<guid isPermaLink="false">http://www.itu.dk/~friism/blog/?p=15#comment-1143</guid>
		<description>[...] query uses Common Table Expressions, which I&#8217;ve dabbled in before. Looking at the execution plan makes my head hurt, but it&#8217;s at least as fast as the original [...]</description>
		<content:encoded><![CDATA[<p>[...] query uses Common Table Expressions, which I&#8217;ve dabbled in before. Looking at the execution plan makes my head hurt, but it&#8217;s at least as fast as the original [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Niels Teglsbo</title>
		<link>http://friism.com/attribute-summing-in-crm-entity-hierarchies/comment-page-1#comment-118</link>
		<dc:creator>Niels Teglsbo</dc:creator>
		<pubDate>Sat, 17 Nov 2007 13:42:33 +0000</pubDate>
		<guid isPermaLink="false">http://www.itu.dk/~friism/blog/?p=15#comment-118</guid>
		<description>Challenge accepted.
There is no need for the sum and group by in the base case.
This gives the same result:
&lt;code&gt;
with num_employees as
(
        select          accountid,
                        numberofemployees
        from            filteredaccount
        union all
        select          fa.parentaccountid,
                        y.numberofemployees
        from            filteredaccount as fa
                        inner join num_employees as y on y.accountid = fa.accountid
)
select sum(numberofemployees),accountid
from num_employees
group by accountid
&lt;/code&gt;
If accountid was not unique it might have made a difference, but in that case the expression doesn&#039;t work anyway.</description>
		<content:encoded><![CDATA[<p>Challenge accepted.<br />
There is no need for the sum and group by in the base case.<br />
This gives the same result:<br />
<code><br />
with num_employees as<br />
(<br />
        select          accountid,<br />
                        numberofemployees<br />
        from            filteredaccount<br />
        union all<br />
        select          fa.parentaccountid,<br />
                        y.numberofemployees<br />
        from            filteredaccount as fa<br />
                        inner join num_employees as y on y.accountid = fa.accountid<br />
)<br />
select sum(numberofemployees),accountid<br />
from num_employees<br />
group by accountid<br />
</code><br />
If accountid was not unique it might have made a difference, but in that case the expression doesn&#8217;t work anyway.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
