<?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; 2005 Explanation and Example &#8211; SELF JOIN</title>
	<atom:link href="http://blog.sqlauthority.com/2007/06/03/sql-server-2005-explanation-and-example-self-join/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.sqlauthority.com/2007/06/03/sql-server-2005-explanation-and-example-self-join/</link>
	<description>Personal Notes of Pinal Dave</description>
	<lastBuildDate>Sat, 25 May 2013 01:31:40 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: pinaldave</title>
		<link>http://blog.sqlauthority.com/2007/06/03/sql-server-2005-explanation-and-example-self-join/#comment-352543</link>
		<dc:creator><![CDATA[pinaldave]]></dc:creator>
		<pubDate>Mon, 24 Sep 2012 10:35:21 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/06/03/sql-server-2005-explanation-and-example-self-join/#comment-352543</guid>
		<description><![CDATA[That is the point. Self join can be outer, inner or cross join and it is not of type of its own.]]></description>
		<content:encoded><![CDATA[<p>That is the point. Self join can be outer, inner or cross join and it is not of type of its own.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anon</title>
		<link>http://blog.sqlauthority.com/2007/06/03/sql-server-2005-explanation-and-example-self-join/#comment-352533</link>
		<dc:creator><![CDATA[Anon]]></dc:creator>
		<pubDate>Mon, 24 Sep 2012 10:11:00 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/06/03/sql-server-2005-explanation-and-example-self-join/#comment-352533</guid>
		<description><![CDATA[A self join is an example of an inner join, the code example even says inner join.  I would not classify this as a &#039;type of join&#039; in its own right.]]></description>
		<content:encoded><![CDATA[<p>A self join is an example of an inner join, the code example even says inner join.  I would not classify this as a &#8216;type of join&#8217; in its own right.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ranak</title>
		<link>http://blog.sqlauthority.com/2007/06/03/sql-server-2005-explanation-and-example-self-join/#comment-290869</link>
		<dc:creator><![CDATA[Ranak]]></dc:creator>
		<pubDate>Wed, 30 May 2012 07:38:55 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/06/03/sql-server-2005-explanation-and-example-self-join/#comment-290869</guid>
		<description><![CDATA[good article]]></description>
		<content:encoded><![CDATA[<p>good article</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Manas</title>
		<link>http://blog.sqlauthority.com/2007/06/03/sql-server-2005-explanation-and-example-self-join/#comment-262514</link>
		<dc:creator><![CDATA[Manas]]></dc:creator>
		<pubDate>Tue, 13 Mar 2012 11:23:52 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/06/03/sql-server-2005-explanation-and-example-self-join/#comment-262514</guid>
		<description><![CDATA[Really fantastic Dave,]]></description>
		<content:encoded><![CDATA[<p>Really fantastic Dave,</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Garima</title>
		<link>http://blog.sqlauthority.com/2007/06/03/sql-server-2005-explanation-and-example-self-join/#comment-260026</link>
		<dc:creator><![CDATA[Garima]]></dc:creator>
		<pubDate>Tue, 06 Mar 2012 11:42:37 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/06/03/sql-server-2005-explanation-and-example-self-join/#comment-260026</guid>
		<description><![CDATA[nice nd very useful article.]]></description>
		<content:encoded><![CDATA[<p>nice nd very useful article.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Garima</title>
		<link>http://blog.sqlauthority.com/2007/06/03/sql-server-2005-explanation-and-example-self-join/#comment-260025</link>
		<dc:creator><![CDATA[Garima]]></dc:creator>
		<pubDate>Tue, 06 Mar 2012 11:37:39 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/06/03/sql-server-2005-explanation-and-example-self-join/#comment-260025</guid>
		<description><![CDATA[nice article]]></description>
		<content:encoded><![CDATA[<p>nice article</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sayan</title>
		<link>http://blog.sqlauthority.com/2007/06/03/sql-server-2005-explanation-and-example-self-join/#comment-207152</link>
		<dc:creator><![CDATA[sayan]]></dc:creator>
		<pubDate>Tue, 29 Nov 2011 11:54:41 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/06/03/sql-server-2005-explanation-and-example-self-join/#comment-207152</guid>
		<description><![CDATA[i want to display data on text box and few of label from two tables emp_master and formula besis of selection of emp_no in combo box, i write down follwing code..bt no data show on textbox and label. any body help .......plz.......

Dim con As New SqlConnection(&quot;Data Source=MICRODAT-39F82C;Initial Catalog=master;Integrated Security=SSPI&quot;)

Dim Da As New SqlDataAdapter
        Dim Da1 As New SqlDataAdapter
        Dim Ds As New DataSet
        Dim Ds1 As New DataSet
        Dim Dt As New DataTable
        Dim Dt1 As New DataTable
        con.Open()

        Try

Da = New SqlDataAdapter(&quot;Select f.Basic_sal,f.d_a,f.p_p,f.c_a,f.h_r_a,f.medical,f.o_a,f.o_t,f.p_f,f.o_p_f,f.loan,f.ad_vance,f.s_s_s,f.elec_charge,f.p_tax,f.i_tax,f.e_s_i,f.gross_sal,f.net_sal,f.date,e.emp_name,e.d_o_b,e.sex,e.d_o_j,e.gard_name,e.present_add from farmula f  INNER JOIN emp_master e ON f.emp_no=&#039;&quot; &amp; ComboBox1.SelectedValue.ToString &amp; &quot;&#039;where e.emp_no=f.emp_no &quot;, con)

Da.Fill(Ds)
Catch ex As Exception
            MessageBox.Show(ex.Message)

TxtBx_EBsic.Text = Ds.Tables(0).Rows(0).Item(&quot;f.Basic_sal&quot;).ToString
            TxtBx_DA.Text = Ds.Tables(0).Rows(0).Item(&quot;f.d_a&quot;).ToString
            TxtBx_PP.Text = Ds.Tables(0).Rows(0).Item(&quot;f.p_p&quot;).ToString
            TxtBx_HRA.Text = Ds.Tables(0).Rows(0).Item(&quot;f.h_r_a&quot;).ToString
            TxtBx_Medi.Text = Ds.Tables(0).Rows(0).Item(&quot;f.medical&quot;).ToString
            TxtBx_CA.Text = Ds.Tables(0).Rows(0).Item(&quot;f.c_a&quot;).ToString
            TxtBx_OA.Text = Ds.Tables(0).Rows(0).Item(&quot;f.o_a&quot;).ToString
            TxtBx_OT.Text = Ds.Tables(0).Rows(0).Item(&quot;f.o_t&quot;).ToString
            TxtBx_Grssal.Text = Ds.Tables(0).Rows(0).Item(&quot;f.gross_sal&quot;).ToString
            TxtBx_pf.Text = Ds.Tables(0).Rows(0).Item(&quot;f.p_f&quot;).ToString
            TxtBx_Opf.Text = Ds.Tables(0).Rows(0).Item(&quot;f.o_p_f&quot;).ToString
            TxtBx_ptax.Text = Ds.Tables(0).Rows(0).Item(&quot;f.p_tax&quot;).ToString
            TxtBx_esi.Text = Ds.Tables(0).Rows(0).Item(&quot;f.e_s_i&quot;).ToString
            TxtBx_BLne.Text = Ds.Tables(0).Rows(0).Item(&quot;f.loan&quot;).ToString
            TxtBx_adv.Text = Ds.Tables(0).Rows(0).Item(&quot;f.ad_vance&quot;).ToString
            TxtBx_elec.Text = Ds.Tables(0).Rows(0).Item(&quot;f.elec_charge&quot;).ToString
            TxtBx_sss.Text = Ds.Tables(0).Rows(0).Item(&quot;f.s_s_s&quot;).ToString
            TxtBx_IT.Text = Ds.Tables(0).Rows(0).Item(&quot;f.i_tax&quot;).ToString
            TxtBx_netpay.Text = Ds.Tables(0).Rows(0).Item(&quot;f.net_sal&quot;).ToString
            txtbx_dt.Text = Ds.Tables(0).Rows(0).Item(&quot;f.date&quot;).ToString
            Label56.Text = Ds.Tables(0).Rows(0).Item(&quot;e.emp_name&quot;).ToString
            Label9.Text = Ds.Tables(0).Rows(0).Item(&quot;e.sex&quot;).ToString
            Label13.Text = Ds.Tables(0).Rows(0).Item(&quot;e.d_o_b&quot;).ToString
            Label57.Text = Ds.Tables(0).Rows(0).Item(&quot;e.present_add&quot;).ToString
            Label1.Text = Ds.Tables(0).Rows(0).Item(&quot;e.gard_name&quot;).ToString
            Label15.Text = Ds.Tables(0).Rows(0).Item(&quot;e.d_o_j&quot;).ToString

        End Try
        con.Close()]]></description>
		<content:encoded><![CDATA[<p>i want to display data on text box and few of label from two tables emp_master and formula besis of selection of emp_no in combo box, i write down follwing code..bt no data show on textbox and label. any body help &#8230;&#8230;.plz&#8230;&#8230;.</p>
<p>Dim con As New SqlConnection(&#8220;Data Source=MICRODAT-39F82C;Initial Catalog=master;Integrated Security=SSPI&#8221;)</p>
<p>Dim Da As New SqlDataAdapter<br />
        Dim Da1 As New SqlDataAdapter<br />
        Dim Ds As New DataSet<br />
        Dim Ds1 As New DataSet<br />
        Dim Dt As New DataTable<br />
        Dim Dt1 As New DataTable<br />
        con.Open()</p>
<p>        Try</p>
<p>Da = New SqlDataAdapter(&#8220;Select f.Basic_sal,f.d_a,f.p_p,f.c_a,f.h_r_a,f.medical,f.o_a,f.o_t,f.p_f,f.o_p_f,f.loan,f.ad_vance,f.s_s_s,f.elec_charge,f.p_tax,f.i_tax,f.e_s_i,f.gross_sal,f.net_sal,f.date,e.emp_name,e.d_o_b,e.sex,e.d_o_j,e.gard_name,e.present_add from farmula f  INNER JOIN emp_master e ON f.emp_no=&#8217;&#8221; &amp; ComboBox1.SelectedValue.ToString &amp; &#8220;&#8216;where e.emp_no=f.emp_no &#8220;, con)</p>
<p>Da.Fill(Ds)<br />
Catch ex As Exception<br />
            MessageBox.Show(ex.Message)</p>
<p>TxtBx_EBsic.Text = Ds.Tables(0).Rows(0).Item(&#8220;f.Basic_sal&#8221;).ToString<br />
            TxtBx_DA.Text = Ds.Tables(0).Rows(0).Item(&#8220;f.d_a&#8221;).ToString<br />
            TxtBx_PP.Text = Ds.Tables(0).Rows(0).Item(&#8220;f.p_p&#8221;).ToString<br />
            TxtBx_HRA.Text = Ds.Tables(0).Rows(0).Item(&#8220;f.h_r_a&#8221;).ToString<br />
            TxtBx_Medi.Text = Ds.Tables(0).Rows(0).Item(&#8220;f.medical&#8221;).ToString<br />
            TxtBx_CA.Text = Ds.Tables(0).Rows(0).Item(&#8220;f.c_a&#8221;).ToString<br />
            TxtBx_OA.Text = Ds.Tables(0).Rows(0).Item(&#8220;f.o_a&#8221;).ToString<br />
            TxtBx_OT.Text = Ds.Tables(0).Rows(0).Item(&#8220;f.o_t&#8221;).ToString<br />
            TxtBx_Grssal.Text = Ds.Tables(0).Rows(0).Item(&#8220;f.gross_sal&#8221;).ToString<br />
            TxtBx_pf.Text = Ds.Tables(0).Rows(0).Item(&#8220;f.p_f&#8221;).ToString<br />
            TxtBx_Opf.Text = Ds.Tables(0).Rows(0).Item(&#8220;f.o_p_f&#8221;).ToString<br />
            TxtBx_ptax.Text = Ds.Tables(0).Rows(0).Item(&#8220;f.p_tax&#8221;).ToString<br />
            TxtBx_esi.Text = Ds.Tables(0).Rows(0).Item(&#8220;f.e_s_i&#8221;).ToString<br />
            TxtBx_BLne.Text = Ds.Tables(0).Rows(0).Item(&#8220;f.loan&#8221;).ToString<br />
            TxtBx_adv.Text = Ds.Tables(0).Rows(0).Item(&#8220;f.ad_vance&#8221;).ToString<br />
            TxtBx_elec.Text = Ds.Tables(0).Rows(0).Item(&#8220;f.elec_charge&#8221;).ToString<br />
            TxtBx_sss.Text = Ds.Tables(0).Rows(0).Item(&#8220;f.s_s_s&#8221;).ToString<br />
            TxtBx_IT.Text = Ds.Tables(0).Rows(0).Item(&#8220;f.i_tax&#8221;).ToString<br />
            TxtBx_netpay.Text = Ds.Tables(0).Rows(0).Item(&#8220;f.net_sal&#8221;).ToString<br />
            txtbx_dt.Text = Ds.Tables(0).Rows(0).Item(&#8220;f.date&#8221;).ToString<br />
            Label56.Text = Ds.Tables(0).Rows(0).Item(&#8220;e.emp_name&#8221;).ToString<br />
            Label9.Text = Ds.Tables(0).Rows(0).Item(&#8220;e.sex&#8221;).ToString<br />
            Label13.Text = Ds.Tables(0).Rows(0).Item(&#8220;e.d_o_b&#8221;).ToString<br />
            Label57.Text = Ds.Tables(0).Rows(0).Item(&#8220;e.present_add&#8221;).ToString<br />
            Label1.Text = Ds.Tables(0).Rows(0).Item(&#8220;e.gard_name&#8221;).ToString<br />
            Label15.Text = Ds.Tables(0).Rows(0).Item(&#8220;e.d_o_j&#8221;).ToString</p>
<p>        End Try<br />
        con.Close()</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SQL SERVER – Interview Questions and Answers – Frequently Asked Questions – Day 4 of 31 Journey to SQLAuthority</title>
		<link>http://blog.sqlauthority.com/2007/06/03/sql-server-2005-explanation-and-example-self-join/#comment-145625</link>
		<dc:creator><![CDATA[SQL SERVER – Interview Questions and Answers – Frequently Asked Questions – Day 4 of 31 Journey to SQLAuthority]]></dc:creator>
		<pubDate>Mon, 04 Jul 2011 01:31:49 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/06/03/sql-server-2005-explanation-and-example-self-join/#comment-145625</guid>
		<description><![CDATA[[...] This is a particular case when one table joins to itself with one or two aliases to avoid confusion. A self join can be of any type, as long as the joined tables are the same. A self join is rather unique in that it involves a relationship with only one table. The common example is when company has a hierarchal reporting structure whereby one member of staff reports to another. Self Join can be Outer Join or Inner Join. (Read more here) [...]]]></description>
		<content:encoded><![CDATA[<p>[...] This is a particular case when one table joins to itself with one or two aliases to avoid confusion. A self join can be of any type, as long as the joined tables are the same. A self join is rather unique in that it involves a relationship with only one table. The common example is when company has a hierarchal reporting structure whereby one member of staff reports to another. Self Join can be Outer Join or Inner Join. (Read more here) [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Francis D</title>
		<link>http://blog.sqlauthority.com/2007/06/03/sql-server-2005-explanation-and-example-self-join/#comment-144907</link>
		<dc:creator><![CDATA[Francis D]]></dc:creator>
		<pubDate>Thu, 30 Jun 2011 16:45:26 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/06/03/sql-server-2005-explanation-and-example-self-join/#comment-144907</guid>
		<description><![CDATA[Hi Pinal Dave

your blog is very useful. encourage all to alway visit this site for reference.
keep it up.]]></description>
		<content:encoded><![CDATA[<p>Hi Pinal Dave</p>
<p>your blog is very useful. encourage all to alway visit this site for reference.<br />
keep it up.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anas Teinah</title>
		<link>http://blog.sqlauthority.com/2007/06/03/sql-server-2005-explanation-and-example-self-join/#comment-107025</link>
		<dc:creator><![CDATA[Anas Teinah]]></dc:creator>
		<pubDate>Tue, 21 Dec 2010 02:33:53 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/06/03/sql-server-2005-explanation-and-example-self-join/#comment-107025</guid>
		<description><![CDATA[i think u dont need self join to answer the query 
&quot;find products that are supplied by more than one vendor&quot;

here is my solution

SELECT ProductID, count(VendorID) as &quot;Num OF Vendors&quot;
FROM Purchasing.ProductVendor pv1
GROUP BY ProductID
HAVING count(VendorID) &gt; 1
ORDER BY ProductID

thank u in advance]]></description>
		<content:encoded><![CDATA[<p>i think u dont need self join to answer the query<br />
&#8220;find products that are supplied by more than one vendor&#8221;</p>
<p>here is my solution</p>
<p>SELECT ProductID, count(VendorID) as &#8220;Num OF Vendors&#8221;<br />
FROM Purchasing.ProductVendor pv1<br />
GROUP BY ProductID<br />
HAVING count(VendorID) &gt; 1<br />
ORDER BY ProductID</p>
<p>thank u in advance</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: siddu</title>
		<link>http://blog.sqlauthority.com/2007/06/03/sql-server-2005-explanation-and-example-self-join/#comment-105983</link>
		<dc:creator><![CDATA[siddu]]></dc:creator>
		<pubDate>Wed, 15 Dec 2010 18:22:08 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/06/03/sql-server-2005-explanation-and-example-self-join/#comment-105983</guid>
		<description><![CDATA[me 2.. :)]]></description>
		<content:encoded><![CDATA[<p>me 2.. :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: naresh</title>
		<link>http://blog.sqlauthority.com/2007/06/03/sql-server-2005-explanation-and-example-self-join/#comment-101482</link>
		<dc:creator><![CDATA[naresh]]></dc:creator>
		<pubDate>Mon, 22 Nov 2010 10:10:50 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/06/03/sql-server-2005-explanation-and-example-self-join/#comment-101482</guid>
		<description><![CDATA[really i like ur response]]></description>
		<content:encoded><![CDATA[<p>really i like ur response</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ASHOK</title>
		<link>http://blog.sqlauthority.com/2007/06/03/sql-server-2005-explanation-and-example-self-join/#comment-83795</link>
		<dc:creator><![CDATA[ASHOK]]></dc:creator>
		<pubDate>Thu, 12 Aug 2010 05:13:12 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/06/03/sql-server-2005-explanation-and-example-self-join/#comment-83795</guid>
		<description><![CDATA[dear sir 
your articles are really very use full for all users .
thanks a lot for create it.]]></description>
		<content:encoded><![CDATA[<p>dear sir<br />
your articles are really very use full for all users .<br />
thanks a lot for create it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: danish khan</title>
		<link>http://blog.sqlauthority.com/2007/06/03/sql-server-2005-explanation-and-example-self-join/#comment-80471</link>
		<dc:creator><![CDATA[danish khan]]></dc:creator>
		<pubDate>Fri, 16 Jul 2010 07:12:30 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/06/03/sql-server-2005-explanation-and-example-self-join/#comment-80471</guid>
		<description><![CDATA[it works efficiently]]></description>
		<content:encoded><![CDATA[<p>it works efficiently</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SQL SERVER – The Self Join – Inner Join and Outer Join Journey to SQL Authority with Pinal Dave</title>
		<link>http://blog.sqlauthority.com/2007/06/03/sql-server-2005-explanation-and-example-self-join/#comment-79147</link>
		<dc:creator><![CDATA[SQL SERVER – The Self Join – Inner Join and Outer Join Journey to SQL Authority with Pinal Dave]]></dc:creator>
		<pubDate>Thu, 08 Jul 2010 01:32:19 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/06/03/sql-server-2005-explanation-and-example-self-join/#comment-79147</guid>
		<description><![CDATA[[...] be the outer join, I often get a request for an example for the same. I have created example using AdventureWorks Database of Self Join earlier, but that was meant for inner join as well. Let us create a new example today, where we [...]]]></description>
		<content:encoded><![CDATA[<p>[...] be the outer join, I often get a request for an example for the same. I have created example using AdventureWorks Database of Self Join earlier, but that was meant for inner join as well. Let us create a new example today, where we [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Paul</title>
		<link>http://blog.sqlauthority.com/2007/06/03/sql-server-2005-explanation-and-example-self-join/#comment-71886</link>
		<dc:creator><![CDATA[Paul]]></dc:creator>
		<pubDate>Thu, 20 May 2010 18:28:04 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/06/03/sql-server-2005-explanation-and-example-self-join/#comment-71886</guid>
		<description><![CDATA[some of you (Srinu, Pravin) are not reading all the comments. Clive Paterson has the solution about eliminating the duplicate records in his comment. So simple.

as Clive said:

&quot;Using less than in the join will eliminate the duplicate results:&quot;

meaning join on the record1.ID &lt; record2.ID as part of your join.

clive&#039;s comment:
http://blog.sqlauthority.com/2007/06/03/sql-server-2005-explanation-and-example-self-join/#comment-52507]]></description>
		<content:encoded><![CDATA[<p>some of you (Srinu, Pravin) are not reading all the comments. Clive Paterson has the solution about eliminating the duplicate records in his comment. So simple.</p>
<p>as Clive said:</p>
<p>&#8220;Using less than in the join will eliminate the duplicate results:&#8221;</p>
<p>meaning join on the record1.ID &lt; record2.ID as part of your join.</p>
<p>clive&#039;s comment:<br />
<a href="http://blog.sqlauthority.com/2007/06/03/sql-server-2005-explanation-and-example-self-join/#comment-52507" rel="nofollow">http://blog.sqlauthority.com/2007/06/03/sql-server-2005-explanation-and-example-self-join/#comment-52507</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Srinu</title>
		<link>http://blog.sqlauthority.com/2007/06/03/sql-server-2005-explanation-and-example-self-join/#comment-71549</link>
		<dc:creator><![CDATA[Srinu]]></dc:creator>
		<pubDate>Wed, 19 May 2010 06:59:44 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/06/03/sql-server-2005-explanation-and-example-self-join/#comment-71549</guid>
		<description><![CDATA[Result iam getting like this.


00002323560	00002323560	189.00000	213.88000
00002323560	00002323560	200.34000	213.88000
00002323701	00002323701	374.39999	399.70001
00002323704	00002323704	3533.33008	3997.00000
00002323704	00002323704	3744.00000	3997.00000
00002323730	00002323730	106.00000	119.91000
00002323730	00002323730	112.32000	119.91000
00002323733	00002323733	353.32999	399.70001
00002323733	00002323733	374.39999	399.70001
00002323734	00002323734	112.32000	119.91000]]></description>
		<content:encoded><![CDATA[<p>Result iam getting like this.</p>
<p>00002323560	00002323560	189.00000	213.88000<br />
00002323560	00002323560	200.34000	213.88000<br />
00002323701	00002323701	374.39999	399.70001<br />
00002323704	00002323704	3533.33008	3997.00000<br />
00002323704	00002323704	3744.00000	3997.00000<br />
00002323730	00002323730	106.00000	119.91000<br />
00002323730	00002323730	112.32000	119.91000<br />
00002323733	00002323733	353.32999	399.70001<br />
00002323733	00002323733	374.39999	399.70001<br />
00002323734	00002323734	112.32000	119.91000</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Srinu</title>
		<link>http://blog.sqlauthority.com/2007/06/03/sql-server-2005-explanation-and-example-self-join/#comment-71547</link>
		<dc:creator><![CDATA[Srinu]]></dc:creator>
		<pubDate>Wed, 19 May 2010 06:57:30 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/06/03/sql-server-2005-explanation-and-example-self-join/#comment-71547</guid>
		<description><![CDATA[hi Pinal Dave,

i have a doubt in self join,

i have written query like this.

SELECT DISTINCT R.NDC,R1.NDC,
R.NPT_PRICEX as LastPrice,
R1.NPT_PRICEX as NewPrice,
from RNP2_NDC_PRICE R 
join 
RNP2_NDC_PRICE R1
on R1.NDC=R.NDC 
and  R1.IsActive=&#039;TRUE&#039;
and R.IsActive=&#039;FALSE&#039; 


iam getting duplicate records through this query,because 
the table having more than one non active records with same NDC.

please help me to avoid duplicate records.]]></description>
		<content:encoded><![CDATA[<p>hi Pinal Dave,</p>
<p>i have a doubt in self join,</p>
<p>i have written query like this.</p>
<p>SELECT DISTINCT R.NDC,R1.NDC,<br />
R.NPT_PRICEX as LastPrice,<br />
R1.NPT_PRICEX as NewPrice,<br />
from RNP2_NDC_PRICE R<br />
join<br />
RNP2_NDC_PRICE R1<br />
on R1.NDC=R.NDC<br />
and  R1.IsActive=&#8217;TRUE&#8217;<br />
and R.IsActive=&#8217;FALSE&#8217; </p>
<p>iam getting duplicate records through this query,because<br />
the table having more than one non active records with same NDC.</p>
<p>please help me to avoid duplicate records.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Aseem</title>
		<link>http://blog.sqlauthority.com/2007/06/03/sql-server-2005-explanation-and-example-self-join/#comment-60374</link>
		<dc:creator><![CDATA[Aseem]]></dc:creator>
		<pubDate>Fri, 29 Jan 2010 11:32:05 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/06/03/sql-server-2005-explanation-and-example-self-join/#comment-60374</guid>
		<description><![CDATA[you are man of vision]]></description>
		<content:encoded><![CDATA[<p>you are man of vision</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: hassum</title>
		<link>http://blog.sqlauthority.com/2007/06/03/sql-server-2005-explanation-and-example-self-join/#comment-60119</link>
		<dc:creator><![CDATA[hassum]]></dc:creator>
		<pubDate>Sat, 23 Jan 2010 04:27:37 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/06/03/sql-server-2005-explanation-and-example-self-join/#comment-60119</guid>
		<description><![CDATA[I&#039;d like to make a qury to give me back the confliction beween starttime and endtime and the period between them,

i want to insert a new field to Lecture table so that it must be not conflicted with the time of other lecture for the same teacher .


thank for help.]]></description>
		<content:encoded><![CDATA[<p>I&#8217;d like to make a qury to give me back the confliction beween starttime and endtime and the period between them,</p>
<p>i want to insert a new field to Lecture table so that it must be not conflicted with the time of other lecture for the same teacher .</p>
<p>thank for help.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brian Tkatch</title>
		<link>http://blog.sqlauthority.com/2007/06/03/sql-server-2005-explanation-and-example-self-join/#comment-58722</link>
		<dc:creator><![CDATA[Brian Tkatch]]></dc:creator>
		<pubDate>Wed, 16 Dec 2009 15:17:42 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/06/03/sql-server-2005-explanation-and-example-self-join/#comment-58722</guid>
		<description><![CDATA[@Pravin

DISTINCT works on the entire record, not just one COLUMN.

Something likw: select ename, MAX(salary) from employee GROUP BY ename; might work for you.]]></description>
		<content:encoded><![CDATA[<p>@Pravin</p>
<p>DISTINCT works on the entire record, not just one COLUMN.</p>
<p>Something likw: select ename, MAX(salary) from employee GROUP BY ename; might work for you.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pravin</title>
		<link>http://blog.sqlauthority.com/2007/06/03/sql-server-2005-explanation-and-example-self-join/#comment-58695</link>
		<dc:creator><![CDATA[Pravin]]></dc:creator>
		<pubDate>Wed, 16 Dec 2009 05:57:02 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/06/03/sql-server-2005-explanation-and-example-self-join/#comment-58695</guid>
		<description><![CDATA[When we select multiple columns with Distinct as Clause
it does not gives distinct values Please see below Eg.

Employee is the Table with values

Santosh Patil	19000
Shilpa Shinde	18000
Ajit	                20000
Pramod	                15000
Pravin	                21000
Prakash	                15000
Ajit 	                35000

Query is 

select distinct ename,salary from employee

O/P show is

Ajit	                20000
Ajit 	                35000
Prakash	                15000
Pramod	                15000
Pravin	                21000
Santosh Patil	19000
Shilpa Shinde	18000

Here there is Duplication of Name Ajit. 

Plz Help me in sorting out this Problem.

Awaiting for Your Favourable reply.

Regards.]]></description>
		<content:encoded><![CDATA[<p>When we select multiple columns with Distinct as Clause<br />
it does not gives distinct values Please see below Eg.</p>
<p>Employee is the Table with values</p>
<p>Santosh Patil	19000<br />
Shilpa Shinde	18000<br />
Ajit	                20000<br />
Pramod	                15000<br />
Pravin	                21000<br />
Prakash	                15000<br />
Ajit 	                35000</p>
<p>Query is </p>
<p>select distinct ename,salary from employee</p>
<p>O/P show is</p>
<p>Ajit	                20000<br />
Ajit 	                35000<br />
Prakash	                15000<br />
Pramod	                15000<br />
Pravin	                21000<br />
Santosh Patil	19000<br />
Shilpa Shinde	18000</p>
<p>Here there is Duplication of Name Ajit. </p>
<p>Plz Help me in sorting out this Problem.</p>
<p>Awaiting for Your Favourable reply.</p>
<p>Regards.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chandraakant H P</title>
		<link>http://blog.sqlauthority.com/2007/06/03/sql-server-2005-explanation-and-example-self-join/#comment-58173</link>
		<dc:creator><![CDATA[Chandraakant H P]]></dc:creator>
		<pubDate>Fri, 04 Dec 2009 06:51:39 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/06/03/sql-server-2005-explanation-and-example-self-join/#comment-58173</guid>
		<description><![CDATA[Nice and important article about self join,really its informative.]]></description>
		<content:encoded><![CDATA[<p>Nice and important article about self join,really its informative.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sanda</title>
		<link>http://blog.sqlauthority.com/2007/06/03/sql-server-2005-explanation-and-example-self-join/#comment-53217</link>
		<dc:creator><![CDATA[Sanda]]></dc:creator>
		<pubDate>Wed, 24 Jun 2009 04:57:21 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/06/03/sql-server-2005-explanation-and-example-self-join/#comment-53217</guid>
		<description><![CDATA[I have one observation regarding the example you gave:

USE AdventureWorks;
GO
SELECT DISTINCT pv1.ProductID, pv1.VendorID
FROM Purchasing.ProductVendor pv1
INNER JOIN Purchasing.ProductVendor pv2
ON pv1.ProductID = pv2.ProductID
AND pv1.VendorID = pv2.VendorID
ORDER BY pv1.ProductID

You said it will &quot;find products that are supplied by more than one vendor&quot;. This query returns all products from the table, not just the ones supplied by 2 or more vendors

Maybe you meant something more like this ( instead of =)

USE AdventureWorks;
GO
SELECT DISTINCT pv1.ProductID, pv1.VendorID
FROM Purchasing.ProductVendor pv1
INNER JOIN Purchasing.ProductVendor pv2
ON pv1.ProductID = pv2.ProductID
AND pv1.VendorID  pv2.VendorID
ORDER BY pv1.ProductID

or even

USE AdventureWorks;
GO
SELECT DISTINCT pv1.ProductID
FROM Purchasing.ProductVendor pv1
INNER JOIN Purchasing.ProductVendor pv2
ON pv1.ProductID = pv2.ProductID
AND pv1.VendorID  pv2.VendorID
ORDER BY pv1.ProductID]]></description>
		<content:encoded><![CDATA[<p>I have one observation regarding the example you gave:</p>
<p>USE AdventureWorks;<br />
GO<br />
SELECT DISTINCT pv1.ProductID, pv1.VendorID<br />
FROM Purchasing.ProductVendor pv1<br />
INNER JOIN Purchasing.ProductVendor pv2<br />
ON pv1.ProductID = pv2.ProductID<br />
AND pv1.VendorID = pv2.VendorID<br />
ORDER BY pv1.ProductID</p>
<p>You said it will &#8220;find products that are supplied by more than one vendor&#8221;. This query returns all products from the table, not just the ones supplied by 2 or more vendors</p>
<p>Maybe you meant something more like this ( instead of =)</p>
<p>USE AdventureWorks;<br />
GO<br />
SELECT DISTINCT pv1.ProductID, pv1.VendorID<br />
FROM Purchasing.ProductVendor pv1<br />
INNER JOIN Purchasing.ProductVendor pv2<br />
ON pv1.ProductID = pv2.ProductID<br />
AND pv1.VendorID  pv2.VendorID<br />
ORDER BY pv1.ProductID</p>
<p>or even</p>
<p>USE AdventureWorks;<br />
GO<br />
SELECT DISTINCT pv1.ProductID<br />
FROM Purchasing.ProductVendor pv1<br />
INNER JOIN Purchasing.ProductVendor pv2<br />
ON pv1.ProductID = pv2.ProductID<br />
AND pv1.VendorID  pv2.VendorID<br />
ORDER BY pv1.ProductID</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Clive Paterson</title>
		<link>http://blog.sqlauthority.com/2007/06/03/sql-server-2005-explanation-and-example-self-join/#comment-52507</link>
		<dc:creator><![CDATA[Clive Paterson]]></dc:creator>
		<pubDate>Thu, 28 May 2009 09:33:37 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/06/03/sql-server-2005-explanation-and-example-self-join/#comment-52507</guid>
		<description><![CDATA[Using less than in the join will eliminate the duplicate results:

USE AdventureWorks;
GO
SELECT DISTINCT pv1.ProductID, pv1.VendorID
FROM Purchasing.ProductVendor pv1
INNER JOIN Purchasing.ProductVendor pv2
ON pv1.ProductID &lt; pv2.ProductID
AND pv1.VendorID &lt; pv2.VendorID
ORDER BY pv1.ProductID1

Image the results set as a square grid where every row from pv1 is join with every row from pv2. Now, using a less than in the join will only join row from pv2 which have an ID greater than the ID in pv1, eliminating duplicates:

&lt;pre&gt;
       pv2

     0 0 0 0 0 0
     x 0 0 0 0 0
p   x x 0 0 0 0
v   x x x 0 0 0
1   x x x x 0 0
     x x x x x 0
&lt;/pre&gt;]]></description>
		<content:encoded><![CDATA[<p>Using less than in the join will eliminate the duplicate results:</p>
<p>USE AdventureWorks;<br />
GO<br />
SELECT DISTINCT pv1.ProductID, pv1.VendorID<br />
FROM Purchasing.ProductVendor pv1<br />
INNER JOIN Purchasing.ProductVendor pv2<br />
ON pv1.ProductID &lt; pv2.ProductID<br />
AND pv1.VendorID &lt; pv2.VendorID<br />
ORDER BY pv1.ProductID1</p>
<p>Image the results set as a square grid where every row from pv1 is join with every row from pv2. Now, using a less than in the join will only join row from pv2 which have an ID greater than the ID in pv1, eliminating duplicates:</p>
<pre>
       pv2

     0 0 0 0 0 0
     x 0 0 0 0 0
p   x x 0 0 0 0
v   x x x 0 0 0
1   x x x x 0 0
     x x x x x 0
</pre>
]]></content:encoded>
	</item>
</channel>
</rss>
