<?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; INNER JOIN Returning More Records than Exists in Table</title>
	<atom:link href="http://blog.sqlauthority.com/2012/02/09/sql-server-inner-join-returning-more-records-than-exists-in-table/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.sqlauthority.com/2012/02/09/sql-server-inner-join-returning-more-records-than-exists-in-table/</link>
	<description>Personal Notes of Pinal Dave</description>
	<lastBuildDate>Fri, 17 May 2013 15:26:57 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: Nikki</title>
		<link>http://blog.sqlauthority.com/2012/02/09/sql-server-inner-join-returning-more-records-than-exists-in-table/#comment-429659</link>
		<dc:creator><![CDATA[Nikki]]></dc:creator>
		<pubDate>Fri, 01 Mar 2013 10:54:26 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=17261#comment-429659</guid>
		<description><![CDATA[Thank you for your article. If you don&#039;t mind, I have a question. I have two tables with information about a sales order. The left hand table contains one row of the sales order header information, sales order number and total etc. I need the required date for the order from the second table. The second table contains multiple rows per sales order as a customer may order an item with different delivery dates. However I only want to return the first required date from that table so that the query only ever outputs one row per sales order. How could I achieve this?]]></description>
		<content:encoded><![CDATA[<p>Thank you for your article. If you don&#8217;t mind, I have a question. I have two tables with information about a sales order. The left hand table contains one row of the sales order header information, sales order number and total etc. I need the required date for the order from the second table. The second table contains multiple rows per sales order as a customer may order an item with different delivery dates. However I only want to return the first required date from that table so that the query only ever outputs one row per sales order. How could I achieve this?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SQL SERVER &#8211; Weekly Series &#8211; Memory Lane &#8211; #015 &#171; SQL Server Journey with SQL Authority</title>
		<link>http://blog.sqlauthority.com/2012/02/09/sql-server-inner-join-returning-more-records-than-exists-in-table/#comment-419700</link>
		<dc:creator><![CDATA[SQL SERVER &#8211; Weekly Series &#8211; Memory Lane &#8211; #015 &#171; SQL Server Journey with SQL Authority]]></dc:creator>
		<pubDate>Sat, 09 Feb 2013 01:31:38 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=17261#comment-419700</guid>
		<description><![CDATA[[...] INNER JOIN Returning More Records than Exists in Table Can inner join return more rows than the rows exists in either of the table. Absolutely! Read this blog for excellent conversation and few interesting pointers why this can happen. I strongly recommend this blog post! There can&#8217;t be any better blog post than this one to end today&#8217;s series. [...]]]></description>
		<content:encoded><![CDATA[<p>[...] INNER JOIN Returning More Records than Exists in Table Can inner join return more rows than the rows exists in either of the table. Absolutely! Read this blog for excellent conversation and few interesting pointers why this can happen. I strongly recommend this blog post! There can&#8217;t be any better blog post than this one to end today&#8217;s series. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: srikanth</title>
		<link>http://blog.sqlauthority.com/2012/02/09/sql-server-inner-join-returning-more-records-than-exists-in-table/#comment-415213</link>
		<dc:creator><![CDATA[srikanth]]></dc:creator>
		<pubDate>Wed, 30 Jan 2013 11:09:03 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=17261#comment-415213</guid>
		<description><![CDATA[hi Pinal,


My name is srikanthreddy
How to use join more than three tables with in one query]]></description>
		<content:encoded><![CDATA[<p>hi Pinal,</p>
<p>My name is srikanthreddy<br />
How to use join more than three tables with in one query</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sahoo</title>
		<link>http://blog.sqlauthority.com/2012/02/09/sql-server-inner-join-returning-more-records-than-exists-in-table/#comment-290011</link>
		<dc:creator><![CDATA[Sahoo]]></dc:creator>
		<pubDate>Mon, 28 May 2012 14:16:56 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=17261#comment-290011</guid>
		<description><![CDATA[Hi Pinal,

I have query related to joining. If I am using a OR condition to join  2tables then I am getting more than the expected number of records if the value matches with both conditions. For example.

select s.id, s.name1,s.name2,d.[desc]
from dbo.Test_Join_Source s
inner join dbo.Test_Join_Destination d
on 
(s.name1=d.name1 or s.name2=d.name2)

The above query will produce 2 records if the source record matches by both the joining condition. 
Question is, How do I prevent this.]]></description>
		<content:encoded><![CDATA[<p>Hi Pinal,</p>
<p>I have query related to joining. If I am using a OR condition to join  2tables then I am getting more than the expected number of records if the value matches with both conditions. For example.</p>
<p>select s.id, s.name1,s.name2,d.[desc]<br />
from dbo.Test_Join_Source s<br />
inner join dbo.Test_Join_Destination d<br />
on<br />
(s.name1=d.name1 or s.name2=d.name2)</p>
<p>The above query will produce 2 records if the source record matches by both the joining condition.<br />
Question is, How do I prevent this.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Amir</title>
		<link>http://blog.sqlauthority.com/2012/02/09/sql-server-inner-join-returning-more-records-than-exists-in-table/#comment-281389</link>
		<dc:creator><![CDATA[Amir]]></dc:creator>
		<pubDate>Wed, 02 May 2012 13:08:06 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=17261#comment-281389</guid>
		<description><![CDATA[We will come across Query3 type often (Ex : One to many Relationship)]]></description>
		<content:encoded><![CDATA[<p>We will come across Query3 type often (Ex : One to many Relationship)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gurjit</title>
		<link>http://blog.sqlauthority.com/2012/02/09/sql-server-inner-join-returning-more-records-than-exists-in-table/#comment-278925</link>
		<dc:creator><![CDATA[Gurjit]]></dc:creator>
		<pubDate>Mon, 23 Apr 2012 20:07:20 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=17261#comment-278925</guid>
		<description><![CDATA[Pinal Dave,

Sincere Thanks. Extremely good article.]]></description>
		<content:encoded><![CDATA[<p>Pinal Dave,</p>
<p>Sincere Thanks. Extremely good article.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SQL SERVER &#8211; Case Sensitive Database and Database User &#8211; Fix: Error: 15151 &#8211; Cannot find the user , because it does not exist or you do not have permission. &#171; SQL Server Journey with SQL Authority</title>
		<link>http://blog.sqlauthority.com/2012/02/09/sql-server-inner-join-returning-more-records-than-exists-in-table/#comment-253702</link>
		<dc:creator><![CDATA[SQL SERVER &#8211; Case Sensitive Database and Database User &#8211; Fix: Error: 15151 &#8211; Cannot find the user , because it does not exist or you do not have permission. &#171; SQL Server Journey with SQL Authority]]></dc:creator>
		<pubDate>Sat, 18 Feb 2012 03:18:00 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=17261#comment-253702</guid>
		<description><![CDATA[[...] SQL SERVER – INNER JOIN Returning More Records than Exists in Table [...]]]></description>
		<content:encoded><![CDATA[<p>[...] SQL SERVER – INNER JOIN Returning More Records than Exists in Table [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Asha Bhatt</title>
		<link>http://blog.sqlauthority.com/2012/02/09/sql-server-inner-join-returning-more-records-than-exists-in-table/#comment-252011</link>
		<dc:creator><![CDATA[Asha Bhatt]]></dc:creator>
		<pubDate>Mon, 13 Feb 2012 10:06:08 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=17261#comment-252011</guid>
		<description><![CDATA[Hi Pinal,

If Not Equal to Sign is giving the duplicate records then why we are using it. What is use of Not Equal to Sign in SQL?

Please tell me.]]></description>
		<content:encoded><![CDATA[<p>Hi Pinal,</p>
<p>If Not Equal to Sign is giving the duplicate records then why we are using it. What is use of Not Equal to Sign in SQL?</p>
<p>Please tell me.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ken</title>
		<link>http://blog.sqlauthority.com/2012/02/09/sql-server-inner-join-returning-more-records-than-exists-in-table/#comment-251225</link>
		<dc:creator><![CDATA[Ken]]></dc:creator>
		<pubDate>Sat, 11 Feb 2012 10:31:23 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=17261#comment-251225</guid>
		<description><![CDATA[Note that &quot;Null = Null is False&quot; is the default behavior, not when you change that behavior with:
SET ANSI_NULLS OFF 

Also &quot;Null != Null is False&quot; is always the same behavior, but the reason it is false changes because of the ANSI_NULLS setting.]]></description>
		<content:encoded><![CDATA[<p>Note that &#8220;Null = Null is False&#8221; is the default behavior, not when you change that behavior with:<br />
SET ANSI_NULLS OFF </p>
<p>Also &#8220;Null != Null is False&#8221; is always the same behavior, but the reason it is false changes because of the ANSI_NULLS setting.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ken</title>
		<link>http://blog.sqlauthority.com/2012/02/09/sql-server-inner-join-returning-more-records-than-exists-in-table/#comment-251223</link>
		<dc:creator><![CDATA[Ken]]></dc:creator>
		<pubDate>Sat, 11 Feb 2012 10:17:13 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=17261#comment-251223</guid>
		<description><![CDATA[I saw the challange and didn&#039;t look at the article. Of course, it&#039;s easy. When I did it, I used the &quot;=&quot; query instead of the != query which was my first choice, then, no, I want every table row picked in every join.:
DECLARE @tbl TABLE(i1 int)
INSERT INTO @tbl VALUES (1),(2),(3),(4),(5)
SELECT a.i1 first, b.i1 second
	FROM @tbl a
	INNER JOIN @tbl b
	ON 1=1
Interesting that the result is the same as adding &quot;ORDER BY b.i1, a.i1 so it processes from right to left. IE get the first record of the second table, find all the matches in the first table for that row... If I changed the insert order it would match that insert order since it is a heap table that hasn&#039;t had a chance to fragment.]]></description>
		<content:encoded><![CDATA[<p>I saw the challange and didn&#8217;t look at the article. Of course, it&#8217;s easy. When I did it, I used the &#8220;=&#8221; query instead of the != query which was my first choice, then, no, I want every table row picked in every join.:<br />
DECLARE @tbl TABLE(i1 int)<br />
INSERT INTO @tbl VALUES (1),(2),(3),(4),(5)<br />
SELECT a.i1 first, b.i1 second<br />
	FROM @tbl a<br />
	INNER JOIN @tbl b<br />
	ON 1=1<br />
Interesting that the result is the same as adding &#8220;ORDER BY b.i1, a.i1 so it processes from right to left. IE get the first record of the second table, find all the matches in the first table for that row&#8230; If I changed the insert order it would match that insert order since it is a heap table that hasn&#8217;t had a chance to fragment.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ashlee Caul</title>
		<link>http://blog.sqlauthority.com/2012/02/09/sql-server-inner-join-returning-more-records-than-exists-in-table/#comment-251088</link>
		<dc:creator><![CDATA[Ashlee Caul]]></dc:creator>
		<pubDate>Fri, 10 Feb 2012 22:11:41 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=17261#comment-251088</guid>
		<description><![CDATA[I can visualize what is happening here, but for those who cannot, try 
SELECT f.Col1 fCol1, s.Col1 sCol1
so you can see the column that is matching. This may help you to understand why certain rows are returned.]]></description>
		<content:encoded><![CDATA[<p>I can visualize what is happening here, but for those who cannot, try<br />
SELECT f.Col1 fCol1, s.Col1 sCol1<br />
so you can see the column that is matching. This may help you to understand why certain rows are returned.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SQL SERVER &#8211; A Quick Puzzle on JOIN and NULL &#8211; SQL Brain Teaser &#171; SQL Server Journey with SQL Authority</title>
		<link>http://blog.sqlauthority.com/2012/02/09/sql-server-inner-join-returning-more-records-than-exists-in-table/#comment-250751</link>
		<dc:creator><![CDATA[SQL SERVER &#8211; A Quick Puzzle on JOIN and NULL &#8211; SQL Brain Teaser &#171; SQL Server Journey with SQL Authority]]></dc:creator>
		<pubDate>Fri, 10 Feb 2012 01:31:33 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=17261#comment-250751</guid>
		<description><![CDATA[[...] Comments       GA_googleFillSlot(&quot;sqlauthority_728x90&quot;);     &#171; SQL SERVER &#8211; INNER JOIN Returning More Records than Exists in&#160;Table [...]]]></description>
		<content:encoded><![CDATA[<p>[...] Comments       GA_googleFillSlot(&quot;sqlauthority_728x90&quot;);     &laquo; SQL SERVER &#8211; INNER JOIN Returning More Records than Exists in&nbsp;Table [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ganesh narim</title>
		<link>http://blog.sqlauthority.com/2012/02/09/sql-server-inner-join-returning-more-records-than-exists-in-table/#comment-250417</link>
		<dc:creator><![CDATA[Ganesh narim]]></dc:creator>
		<pubDate>Thu, 09 Feb 2012 12:01:52 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=17261#comment-250417</guid>
		<description><![CDATA[Hi pinal,

i send you one mail please do needful....!!!!!
Hope you help me....!!!]]></description>
		<content:encoded><![CDATA[<p>Hi pinal,</p>
<p>i send you one mail please do needful&#8230;.!!!!!<br />
Hope you help me&#8230;.!!!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: pinaldave</title>
		<link>http://blog.sqlauthority.com/2012/02/09/sql-server-inner-join-returning-more-records-than-exists-in-table/#comment-250402</link>
		<dc:creator><![CDATA[pinaldave]]></dc:creator>
		<pubDate>Thu, 09 Feb 2012 10:31:47 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=17261#comment-250402</guid>
		<description><![CDATA[Excellent comment my friend. Love it!]]></description>
		<content:encoded><![CDATA[<p>Excellent comment my friend. Love it!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ganesh Narim</title>
		<link>http://blog.sqlauthority.com/2012/02/09/sql-server-inner-join-returning-more-records-than-exists-in-table/#comment-250385</link>
		<dc:creator><![CDATA[Ganesh Narim]]></dc:creator>
		<pubDate>Thu, 09 Feb 2012 09:40:35 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=17261#comment-250385</guid>
		<description><![CDATA[Hi Pinal,

it is very nice example.

I like very much that Querry.1 it tells that.

Null = Null    = False
Null  is  Null  = True.

Wow..!! What a romantic SQL language we have..!!!!!
One of my friends asking me like this &quot;How can i learn SQL Easily...!!!! is there any trick for this..???&quot;

I told him that Do like this then you will get it easily..

Eat SQL,
Drink SQL,
Play With SQL,
Dream SQL,
Sing SQL,
Sleep with SQL,
Wake up with SQL......!!!!!]]></description>
		<content:encoded><![CDATA[<p>Hi Pinal,</p>
<p>it is very nice example.</p>
<p>I like very much that Querry.1 it tells that.</p>
<p>Null = Null    = False<br />
Null  is  Null  = True.</p>
<p>Wow..!! What a romantic SQL language we have..!!!!!<br />
One of my friends asking me like this &#8220;How can i learn SQL Easily&#8230;!!!! is there any trick for this..???&#8221;</p>
<p>I told him that Do like this then you will get it easily..</p>
<p>Eat SQL,<br />
Drink SQL,<br />
Play With SQL,<br />
Dream SQL,<br />
Sing SQL,<br />
Sleep with SQL,<br />
Wake up with SQL&#8230;&#8230;!!!!!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sreelekha Vikram</title>
		<link>http://blog.sqlauthority.com/2012/02/09/sql-server-inner-join-returning-more-records-than-exists-in-table/#comment-250301</link>
		<dc:creator><![CDATA[Sreelekha Vikram]]></dc:creator>
		<pubDate>Thu, 09 Feb 2012 05:57:04 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=17261#comment-250301</guid>
		<description><![CDATA[Hi Pinal,

Is this kind of behavior observed only in inner join or even in other joins?]]></description>
		<content:encoded><![CDATA[<p>Hi Pinal,</p>
<p>Is this kind of behavior observed only in inner join or even in other joins?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chirag Satasiya</title>
		<link>http://blog.sqlauthority.com/2012/02/09/sql-server-inner-join-returning-more-records-than-exists-in-table/#comment-250290</link>
		<dc:creator><![CDATA[Chirag Satasiya]]></dc:creator>
		<pubDate>Thu, 09 Feb 2012 05:18:02 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=17261#comment-250290</guid>
		<description><![CDATA[Hi pinal sir,
We are also faced such kind of senarion many times while using inner join for more than 2 tables. We then find out that using proper join and distinct we are able to avoid such result.

Thank$ 
Chirag Satasiya]]></description>
		<content:encoded><![CDATA[<p>Hi pinal sir,<br />
We are also faced such kind of senarion many times while using inner join for more than 2 tables. We then find out that using proper join and distinct we are able to avoid such result.</p>
<p>Thank$<br />
Chirag Satasiya</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dewesh Pushkar</title>
		<link>http://blog.sqlauthority.com/2012/02/09/sql-server-inner-join-returning-more-records-than-exists-in-table/#comment-250282</link>
		<dc:creator><![CDATA[Dewesh Pushkar]]></dc:creator>
		<pubDate>Thu, 09 Feb 2012 04:26:14 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=17261#comment-250282</guid>
		<description><![CDATA[It was really awsome.......PINAL]]></description>
		<content:encoded><![CDATA[<p>It was really awsome&#8230;&#8230;.PINAL</p>
]]></content:encoded>
	</item>
</channel>
</rss>
