<?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: SQL SERVER &#8211; Introduction and Example of UNION and UNION ALL</title>
	<atom:link href="http://blog.sqlauthority.com/2008/10/15/sql-server-introduction-and-example-of-union-and-union-all/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.sqlauthority.com/2008/10/15/sql-server-introduction-and-example-of-union-and-union-all/</link>
	<description>Personal Notes of Pinal Dave</description>
	<lastBuildDate>Sun, 12 Feb 2012 09:22:39 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: sagar koti</title>
		<link>http://blog.sqlauthority.com/2008/10/15/sql-server-introduction-and-example-of-union-and-union-all/#comment-221161</link>
		<dc:creator><![CDATA[sagar koti]]></dc:creator>
		<pubDate>Mon, 19 Dec 2011 08:07:01 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=1364#comment-221161</guid>
		<description><![CDATA[how to give descriptive headers for each column we pull from the database for the fixed length query.]]></description>
		<content:encoded><![CDATA[<p>how to give descriptive headers for each column we pull from the database for the fixed length query.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: JACOB</title>
		<link>http://blog.sqlauthority.com/2008/10/15/sql-server-introduction-and-example-of-union-and-union-all/#comment-151046</link>
		<dc:creator><![CDATA[JACOB]]></dc:creator>
		<pubDate>Wed, 27 Jul 2011 12:56:33 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=1364#comment-151046</guid>
		<description><![CDATA[Hi Ria,
Did you ever get a solution for this? What alternative did you use?]]></description>
		<content:encoded><![CDATA[<p>Hi Ria,<br />
Did you ever get a solution for this? What alternative did you use?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Madhivanan</title>
		<link>http://blog.sqlauthority.com/2008/10/15/sql-server-introduction-and-example-of-union-and-union-all/#comment-63246</link>
		<dc:creator><![CDATA[Madhivanan]]></dc:creator>
		<pubDate>Fri, 19 Mar 2010 08:10:08 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=1364#comment-63246</guid>
		<description><![CDATA[Also beware of implicit convertions

select 10
union all
select getdate()]]></description>
		<content:encoded><![CDATA[<p>Also beware of implicit convertions</p>
<p>select 10<br />
union all<br />
select getdate()</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brian Tkatch</title>
		<link>http://blog.sqlauthority.com/2008/10/15/sql-server-introduction-and-example-of-union-and-union-all/#comment-61248</link>
		<dc:creator><![CDATA[Brian Tkatch]]></dc:creator>
		<pubDate>Tue, 16 Feb 2010 13:19:45 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=1364#comment-61248</guid>
		<description><![CDATA[@navi

please show the query so someone can help you with it.]]></description>
		<content:encoded><![CDATA[<p>@navi</p>
<p>please show the query so someone can help you with it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: navi</title>
		<link>http://blog.sqlauthority.com/2008/10/15/sql-server-introduction-and-example-of-union-and-union-all/#comment-61201</link>
		<dc:creator><![CDATA[navi]]></dc:creator>
		<pubDate>Mon, 15 Feb 2010 19:37:52 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=1364#comment-61201</guid>
		<description><![CDATA[Hi
I have a question .

I need to use select statement and use two from clauses.

that is, everything is same in both the select statements and from clause except there is an extra join in one from clause. what i am trying to do is use condition and take the reqired from clause but i could not do it.

Any help plz]]></description>
		<content:encoded><![CDATA[<p>Hi<br />
I have a question .</p>
<p>I need to use select statement and use two from clauses.</p>
<p>that is, everything is same in both the select statements and from clause except there is an extra join in one from clause. what i am trying to do is use condition and take the reqired from clause but i could not do it.</p>
<p>Any help plz</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Aparna</title>
		<link>http://blog.sqlauthority.com/2008/10/15/sql-server-introduction-and-example-of-union-and-union-all/#comment-52639</link>
		<dc:creator><![CDATA[Aparna]]></dc:creator>
		<pubDate>Tue, 02 Jun 2009 07:58:46 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=1364#comment-52639</guid>
		<description><![CDATA[I was short of time with lots of work in hand so did not really look at the execution plan. I will post my findings in this forum. Thanks Imran for your suggestion. wondering if anyone had similar issues.

FYI Table 1 is not distint by itself and Table 2 is not distinct by itself but there are dateid&#039;s in Table1 and Table2 that makes their union distinct

TABLE1
DATEID       INVESTOR
20090530  1
20090530  2
20090530 1

TABLE 2

DATEID       INVESTOR
20090630  1
20090630  2
20090630 1

Any one has thoughts until I look at the execution plan]]></description>
		<content:encoded><![CDATA[<p>I was short of time with lots of work in hand so did not really look at the execution plan. I will post my findings in this forum. Thanks Imran for your suggestion. wondering if anyone had similar issues.</p>
<p>FYI Table 1 is not distint by itself and Table 2 is not distinct by itself but there are dateid&#8217;s in Table1 and Table2 that makes their union distinct</p>
<p>TABLE1<br />
DATEID       INVESTOR<br />
20090530  1<br />
20090530  2<br />
20090530 1</p>
<p>TABLE 2</p>
<p>DATEID       INVESTOR<br />
20090630  1<br />
20090630  2<br />
20090630 1</p>
<p>Any one has thoughts until I look at the execution plan</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Imran Mohammed</title>
		<link>http://blog.sqlauthority.com/2008/10/15/sql-server-introduction-and-example-of-union-and-union-all/#comment-52631</link>
		<dc:creator><![CDATA[Imran Mohammed]]></dc:creator>
		<pubDate>Tue, 02 Jun 2009 04:59:59 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=1364#comment-52631</guid>
		<description><![CDATA[@Aparna, 

Why don&#039;t you look at Execution plan. Look at cost of each step and each query. You will get an answer.

Also, please post your observation.

~ IM.]]></description>
		<content:encoded><![CDATA[<p>@Aparna, </p>
<p>Why don&#8217;t you look at Execution plan. Look at cost of each step and each query. You will get an answer.</p>
<p>Also, please post your observation.</p>
<p>~ IM.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Aparna</title>
		<link>http://blog.sqlauthority.com/2008/10/15/sql-server-introduction-and-example-of-union-and-union-all/#comment-52626</link>
		<dc:creator><![CDATA[Aparna]]></dc:creator>
		<pubDate>Tue, 02 Jun 2009 02:28:42 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=1364#comment-52626</guid>
		<description><![CDATA[I was looking at performance gaining and a friend of mine doing a peer review of my code suggested that we use union all instead of union, I was not sure how I will gain performance and while researching came across your article. 

I do need a distinct list of records and therefore used union
but she has an opinion that I do a union all and then group by the columns individually before applying union all. 

Which is best?
get the distinct list of table 1 (by using group by clause) and distinct list of table2 and then do union all 

or select list from table 1 and select list from table 2 and do union there by eliminating duplicates in individual tables]]></description>
		<content:encoded><![CDATA[<p>I was looking at performance gaining and a friend of mine doing a peer review of my code suggested that we use union all instead of union, I was not sure how I will gain performance and while researching came across your article. </p>
<p>I do need a distinct list of records and therefore used union<br />
but she has an opinion that I do a union all and then group by the columns individually before applying union all. </p>
<p>Which is best?<br />
get the distinct list of table 1 (by using group by clause) and distinct list of table2 and then do union all </p>
<p>or select list from table 1 and select list from table 2 and do union there by eliminating duplicates in individual tables</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ria</title>
		<link>http://blog.sqlauthority.com/2008/10/15/sql-server-introduction-and-example-of-union-and-union-all/#comment-52534</link>
		<dc:creator><![CDATA[Ria]]></dc:creator>
		<pubDate>Fri, 29 May 2009 11:11:55 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=1364#comment-52534</guid>
		<description><![CDATA[Is it possible to use &#039;union all&#039; in hibernate, Since I am using Java and Hibernate for my application, I need to convert the query using &#039;union all&#039; to hibernate.Please Help me to solve this issue.]]></description>
		<content:encoded><![CDATA[<p>Is it possible to use &#8216;union all&#8217; in hibernate, Since I am using Java and Hibernate for my application, I need to convert the query using &#8216;union all&#8217; to hibernate.Please Help me to solve this issue.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: chris</title>
		<link>http://blog.sqlauthority.com/2008/10/15/sql-server-introduction-and-example-of-union-and-union-all/#comment-50261</link>
		<dc:creator><![CDATA[chris]]></dc:creator>
		<pubDate>Tue, 31 Mar 2009 06:00:46 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=1364#comment-50261</guid>
		<description><![CDATA[sorry for the dumb question, i should have included tcol3 in my inner query...]]></description>
		<content:encoded><![CDATA[<p>sorry for the dumb question, i should have included tcol3 in my inner query&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: chris</title>
		<link>http://blog.sqlauthority.com/2008/10/15/sql-server-introduction-and-example-of-union-and-union-all/#comment-50260</link>
		<dc:creator><![CDATA[chris]]></dc:creator>
		<pubDate>Tue, 31 Mar 2009 05:55:17 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=1364#comment-50260</guid>
		<description><![CDATA[is ther a way to use a union all statement and then issue a where at the end to filter the entire query?

example:

table 1 
tcol1 tcol2 tcol3
1      1       1
2      2       1

table 2
tcol1 tcol2 tcol3
3      3       1
4      4       2

SELECT tcol1,tcol2 FROM (
SELECT tcol1,tcol2
UNION ALL
SELECT tcol1,tcol2
) AS temptable
WHERE tcol3=&#039;1&#039;  &lt;--- 

thanks]]></description>
		<content:encoded><![CDATA[<p>is ther a way to use a union all statement and then issue a where at the end to filter the entire query?</p>
<p>example:</p>
<p>table 1<br />
tcol1 tcol2 tcol3<br />
1      1       1<br />
2      2       1</p>
<p>table 2<br />
tcol1 tcol2 tcol3<br />
3      3       1<br />
4      4       2</p>
<p>SELECT tcol1,tcol2 FROM (<br />
SELECT tcol1,tcol2<br />
UNION ALL<br />
SELECT tcol1,tcol2<br />
) AS temptable<br />
WHERE tcol3=&#8217;1&#8242;  &lt;&#8212; </p>
<p>thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Siuli Basu</title>
		<link>http://blog.sqlauthority.com/2008/10/15/sql-server-introduction-and-example-of-union-and-union-all/#comment-45222</link>
		<dc:creator><![CDATA[Siuli Basu]]></dc:creator>
		<pubDate>Wed, 31 Dec 2008 08:43:40 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=1364#comment-45222</guid>
		<description><![CDATA[I want to know the difference between UNION and INSERT INTO]]></description>
		<content:encoded><![CDATA[<p>I want to know the difference between UNION and INSERT INTO</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Vani K Patil</title>
		<link>http://blog.sqlauthority.com/2008/10/15/sql-server-introduction-and-example-of-union-and-union-all/#comment-44151</link>
		<dc:creator><![CDATA[Vani K Patil]]></dc:creator>
		<pubDate>Tue, 11 Nov 2008 09:34:05 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=1364#comment-44151</guid>
		<description><![CDATA[First time i am going through this site.It&#039;s simply the best.
U have all the details without redundant details. Thanks tons for this.]]></description>
		<content:encoded><![CDATA[<p>First time i am going through this site.It&#8217;s simply the best.<br />
U have all the details without redundant details. Thanks tons for this.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Joggee</title>
		<link>http://blog.sqlauthority.com/2008/10/15/sql-server-introduction-and-example-of-union-and-union-all/#comment-43703</link>
		<dc:creator><![CDATA[Joggee]]></dc:creator>
		<pubDate>Wed, 15 Oct 2008 03:32:05 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=1364#comment-43703</guid>
		<description><![CDATA[Its a hobby to read your blog&#039;s article on daily basis to refresh my knowledge.

Some tricky part which mostly ignore, Catch it from your articles.

Keep up the good work.

God Bless you

Joggee.]]></description>
		<content:encoded><![CDATA[<p>Its a hobby to read your blog&#8217;s article on daily basis to refresh my knowledge.</p>
<p>Some tricky part which mostly ignore, Catch it from your articles.</p>
<p>Keep up the good work.</p>
<p>God Bless you</p>
<p>Joggee.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Imran Mohammed</title>
		<link>http://blog.sqlauthority.com/2008/10/15/sql-server-introduction-and-example-of-union-and-union-all/#comment-43701</link>
		<dc:creator><![CDATA[Imran Mohammed]]></dc:creator>
		<pubDate>Wed, 15 Oct 2008 02:04:23 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=1364#comment-43701</guid>
		<description><![CDATA[Hello, 

I wish I had read this article one day before. 

Yesterday when I was working on one production issue, I saw a strange case, in which we create two temporary table on the fly, and then we do a select statement with a union. Every time we use to get an error... You wont believe we spent 2-3 hours on it. At last we saw the temporary tables that were created with select * into command was creating different datatype, one with int and another with char, and union was not able to perform its action and our process was failing. I learnt a good lesson, it was worth it :)

Thanks,
Imran.]]></description>
		<content:encoded><![CDATA[<p>Hello, </p>
<p>I wish I had read this article one day before. </p>
<p>Yesterday when I was working on one production issue, I saw a strange case, in which we create two temporary table on the fly, and then we do a select statement with a union. Every time we use to get an error&#8230; You wont believe we spent 2-3 hours on it. At last we saw the temporary tables that were created with select * into command was creating different datatype, one with int and another with char, and union was not able to perform its action and our process was failing. I learnt a good lesson, it was worth it :)</p>
<p>Thanks,<br />
Imran.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

