 




<?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: Combining 2 queries in SQL 2008</title>
	<atom:link href="http://itknowledgeexchange.techtarget.com/itanswers/combining-2-queries/feed/" rel="self" type="application/rss+xml" />
	<link>http://itknowledgeexchange.techtarget.com/itanswers/combining-2-queries/</link>
	<description></description>
	<lastBuildDate>Tue, 21 May 2013 22:12:11 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
	<item>
		<title>By: DavidHa!!</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/combining-2-queries/#comment-88993</link>
		<dc:creator>DavidHa!!</dc:creator>
		<pubDate>Fri, 04 Mar 2011 19:20:38 +0000</pubDate>
		<guid isPermaLink="false">#comment-88993</guid>
		<description><![CDATA[thanks Mariodlg, but no go. I have a solution to the original question but look at the next post for more...]]></description>
		<content:encoded><![CDATA[<p>thanks Mariodlg, but no go. I have a solution to the original question but look at the next post for more&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mariodlg</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/combining-2-queries/#comment-88988</link>
		<dc:creator>mariodlg</dc:creator>
		<pubDate>Fri, 04 Mar 2011 18:08:51 +0000</pubDate>
		<guid isPermaLink="false">#comment-88988</guid>
		<description><![CDATA[It seems to be very simple in SQL Server.
I tried to make a SQL standard query using subselect, in order to get  the same results in another database manager. 

Here it is:

select tmp.Eff_date, tmp.CoNum, sum(tmp.CountOfBrandname) from 
( select Eff_date, CoNum, count(Brandname) as CountOfBrandname, Brandname, Dateapplied
from Products 
where Eff_date between &#039;01/02/2011&#039; and &#039;05/02/2011&#039; 
group by Eff_date, CoNum, Brandname, Dateapplied) as tmp
group by tmp.Eff_date, tmp.CoNum;

Tell us if you get the desired results.
Regards.]]></description>
		<content:encoded><![CDATA[<p>It seems to be very simple in SQL Server.<br />
I tried to make a SQL standard query using subselect, in order to get  the same results in another database manager. </p>
<p>Here it is:</p>
<p>select tmp.Eff_date, tmp.CoNum, sum(tmp.CountOfBrandname) from<br />
( select Eff_date, CoNum, count(Brandname) as CountOfBrandname, Brandname, Dateapplied<br />
from Products<br />
where Eff_date between &#8217;01/02/2011&#8242; and &#8217;05/02/2011&#8242;<br />
group by Eff_date, CoNum, Brandname, Dateapplied) as tmp<br />
group by tmp.Eff_date, tmp.CoNum;</p>
<p>Tell us if you get the desired results.<br />
Regards.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: DavidHa!!</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/combining-2-queries/#comment-88987</link>
		<dc:creator>DavidHa!!</dc:creator>
		<pubDate>Fri, 04 Mar 2011 17:49:32 +0000</pubDate>
		<guid isPermaLink="false">#comment-88987</guid>
		<description><![CDATA[Thanks BigKat..nice work. To take it one step further, how about the ability to produce a total number of conum&#039;s and the sum of the Sumofbrandname columns. This would end up with including select count (conum), sum(sumofbrandnames) as the final result. Can this also be added to the above query?]]></description>
		<content:encoded><![CDATA[<p>Thanks BigKat..nice work. To take it one step further, how about the ability to produce a total number of conum&#8217;s and the sum of the Sumofbrandname columns. This would end up with including select count (conum), sum(sumofbrandnames) as the final result. Can this also be added to the above query?</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using memcached
Database Caching 3/10 queries in 0.035 seconds using memcached
Object Caching 295/301 objects using memcached

Served from: itknowledgeexchange.techtarget.com @ 2013-05-21 22:37:48 -->