<?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; Count Duplicate Records &#8211; Rows</title>
	<atom:link href="http://blog.sqlauthority.com/2007/07/11/sql-server-count-duplicate-records-rows/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.sqlauthority.com/2007/07/11/sql-server-count-duplicate-records-rows/</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: Deepak</title>
		<link>http://blog.sqlauthority.com/2007/07/11/sql-server-count-duplicate-records-rows/#comment-476277</link>
		<dc:creator><![CDATA[Deepak]]></dc:creator>
		<pubDate>Thu, 16 May 2013 06:32:52 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/07/11/sql-server-count-duplicate-records-rows/#comment-476277</guid>
		<description><![CDATA[I have got 1 Solution 

select ID,case 
when (select distinct 1 from table2 where table1.ID=table2.ID)=1
then value+&#039; EXIST&#039;
else
value+&#039; NOT EXIST&#039;
end
as status
 from table1 

any better solution would be appreciable..

Thanks,
Deepak]]></description>
		<content:encoded><![CDATA[<p>I have got 1 Solution </p>
<p>select ID,case<br />
when (select distinct 1 from table2 where table1.ID=table2.ID)=1<br />
then value+&#8217; EXIST&#8217;<br />
else<br />
value+&#8217; NOT EXIST&#8217;<br />
end<br />
as status<br />
 from table1 </p>
<p>any better solution would be appreciable..</p>
<p>Thanks,<br />
Deepak</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Deepak</title>
		<link>http://blog.sqlauthority.com/2007/07/11/sql-server-count-duplicate-records-rows/#comment-475608</link>
		<dc:creator><![CDATA[Deepak]]></dc:creator>
		<pubDate>Wed, 15 May 2013 07:45:34 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/07/11/sql-server-count-duplicate-records-rows/#comment-475608</guid>
		<description><![CDATA[Hi Pinal,

I want to fetch the records from table1 having primary key ID but 1 column value depends on the condition and condition is : if ID is available in another table then column value should be “ColumnValue EXIST” if Not in another table then “ColumnValue NOT EXIST”.

Means I want to append some text to that column based on condition.

Thanks,
Deepak]]></description>
		<content:encoded><![CDATA[<p>Hi Pinal,</p>
<p>I want to fetch the records from table1 having primary key ID but 1 column value depends on the condition and condition is : if ID is available in another table then column value should be “ColumnValue EXIST” if Not in another table then “ColumnValue NOT EXIST”.</p>
<p>Means I want to append some text to that column based on condition.</p>
<p>Thanks,<br />
Deepak</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: keerthi</title>
		<link>http://blog.sqlauthority.com/2007/07/11/sql-server-count-duplicate-records-rows/#comment-411652</link>
		<dc:creator><![CDATA[keerthi]]></dc:creator>
		<pubDate>Wed, 23 Jan 2013 07:01:54 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/07/11/sql-server-count-duplicate-records-rows/#comment-411652</guid>
		<description><![CDATA[Thanks Mr.Pinal Dave]]></description>
		<content:encoded><![CDATA[<p>Thanks Mr.Pinal Dave</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jewel</title>
		<link>http://blog.sqlauthority.com/2007/07/11/sql-server-count-duplicate-records-rows/#comment-410646</link>
		<dc:creator><![CDATA[Jewel]]></dc:creator>
		<pubDate>Mon, 21 Jan 2013 10:26:31 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/07/11/sql-server-count-duplicate-records-rows/#comment-410646</guid>
		<description><![CDATA[Thank you Pinal Dave]]></description>
		<content:encoded><![CDATA[<p>Thank you Pinal Dave</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: dorababu743</title>
		<link>http://blog.sqlauthority.com/2007/07/11/sql-server-count-duplicate-records-rows/#comment-408426</link>
		<dc:creator><![CDATA[dorababu743]]></dc:creator>
		<pubDate>Wed, 16 Jan 2013 09:17:04 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/07/11/sql-server-count-duplicate-records-rows/#comment-408426</guid>
		<description><![CDATA[Hi I am having a small requirement i.e I am having an Employee and Address tables where Employee table holds ID,Name and Address holds ID(foreign key) and Address. My data is as follows

Employee Address

1 Dorababu 1 XYZ
2 Vivekh 1 XYZ
3 Kaashyap 2 ABC

I would like to display all the employees who is having same address, I tried using joins but I am getting duplicates can some one help me]]></description>
		<content:encoded><![CDATA[<p>Hi I am having a small requirement i.e I am having an Employee and Address tables where Employee table holds ID,Name and Address holds ID(foreign key) and Address. My data is as follows</p>
<p>Employee Address</p>
<p>1 Dorababu 1 XYZ<br />
2 Vivekh 1 XYZ<br />
3 Kaashyap 2 ABC</p>
<p>I would like to display all the employees who is having same address, I tried using joins but I am getting duplicates can some one help me</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pranay</title>
		<link>http://blog.sqlauthority.com/2007/07/11/sql-server-count-duplicate-records-rows/#comment-396215</link>
		<dc:creator><![CDATA[Pranay]]></dc:creator>
		<pubDate>Wed, 19 Dec 2012 18:35:28 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/07/11/sql-server-count-duplicate-records-rows/#comment-396215</guid>
		<description><![CDATA[I want to find duplicates record on the basis of fields FirstName, MiddleName, LastName from my table. I have 40 Lakhs of records in table. So any optimise query to show result in less time in SQL Server 2008 and system Specification for Such large amount of data for searching purpose.]]></description>
		<content:encoded><![CDATA[<p>I want to find duplicates record on the basis of fields FirstName, MiddleName, LastName from my table. I have 40 Lakhs of records in table. So any optimise query to show result in less time in SQL Server 2008 and system Specification for Such large amount of data for searching purpose.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: paulb0609</title>
		<link>http://blog.sqlauthority.com/2007/07/11/sql-server-count-duplicate-records-rows/#comment-395998</link>
		<dc:creator><![CDATA[paulb0609]]></dc:creator>
		<pubDate>Wed, 19 Dec 2012 10:53:31 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/07/11/sql-server-count-duplicate-records-rows/#comment-395998</guid>
		<description><![CDATA[Good]]></description>
		<content:encoded><![CDATA[<p>Good</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SQL SERVER &#8211; Select and Delete Duplicate Records &#8211; SQL in Sixty Seconds #036 &#8211; Video &#171; SQL Server Journey with SQL Authority</title>
		<link>http://blog.sqlauthority.com/2007/07/11/sql-server-count-duplicate-records-rows/#comment-395754</link>
		<dc:creator><![CDATA[SQL SERVER &#8211; Select and Delete Duplicate Records &#8211; SQL in Sixty Seconds #036 &#8211; Video &#171; SQL Server Journey with SQL Authority]]></dc:creator>
		<pubDate>Wed, 19 Dec 2012 01:30:28 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/07/11/sql-server-count-duplicate-records-rows/#comment-395754</guid>
		<description><![CDATA[[...] SQL SERVER – Count Duplicate Records – Rows [...]]]></description>
		<content:encoded><![CDATA[<p>[...] SQL SERVER – Count Duplicate Records – Rows [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Antonio</title>
		<link>http://blog.sqlauthority.com/2007/07/11/sql-server-count-duplicate-records-rows/#comment-379490</link>
		<dc:creator><![CDATA[Antonio]]></dc:creator>
		<pubDate>Fri, 23 Nov 2012 17:10:53 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/07/11/sql-server-count-duplicate-records-rows/#comment-379490</guid>
		<description><![CDATA[Grazie]]></description>
		<content:encoded><![CDATA[<p>Grazie</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jacksonemmerich</title>
		<link>http://blog.sqlauthority.com/2007/07/11/sql-server-count-duplicate-records-rows/#comment-361764</link>
		<dc:creator><![CDATA[jacksonemmerich]]></dc:creator>
		<pubDate>Thu, 18 Oct 2012 23:34:54 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/07/11/sql-server-count-duplicate-records-rows/#comment-361764</guid>
		<description><![CDATA[thank you. !!!]]></description>
		<content:encoded><![CDATA[<p>thank you. !!!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jible</title>
		<link>http://blog.sqlauthority.com/2007/07/11/sql-server-count-duplicate-records-rows/#comment-359210</link>
		<dc:creator><![CDATA[Jible]]></dc:creator>
		<pubDate>Fri, 12 Oct 2012 16:12:09 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/07/11/sql-server-count-duplicate-records-rows/#comment-359210</guid>
		<description><![CDATA[This solution would be fine, except this is part of a weekly SQL job and it resets all duplicates each week and therefore places a duplicate order for that first record each week by changing the fulfilled date to the current week. I want to only update the first record when there isn’t one with a Fulfilled date already in the duplicate set. I’m not sure if this makes sense.]]></description>
		<content:encoded><![CDATA[<p>This solution would be fine, except this is part of a weekly SQL job and it resets all duplicates each week and therefore places a duplicate order for that first record each week by changing the fulfilled date to the current week. I want to only update the first record when there isn’t one with a Fulfilled date already in the duplicate set. I’m not sure if this makes sense.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gautac18</title>
		<link>http://blog.sqlauthority.com/2007/07/11/sql-server-count-duplicate-records-rows/#comment-351402</link>
		<dc:creator><![CDATA[Gautac18]]></dc:creator>
		<pubDate>Thu, 20 Sep 2012 14:22:49 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/07/11/sql-server-count-duplicate-records-rows/#comment-351402</guid>
		<description><![CDATA[madhivanan,

Your solution worked perfectly for me with a minor tweak to meet my desired outcome.   Thank you!]]></description>
		<content:encoded><![CDATA[<p>madhivanan,</p>
<p>Your solution worked perfectly for me with a minor tweak to meet my desired outcome.   Thank you!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark</title>
		<link>http://blog.sqlauthority.com/2007/07/11/sql-server-count-duplicate-records-rows/#comment-341538</link>
		<dc:creator><![CDATA[Mark]]></dc:creator>
		<pubDate>Thu, 06 Sep 2012 15:28:23 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/07/11/sql-server-count-duplicate-records-rows/#comment-341538</guid>
		<description><![CDATA[Hi Guys, 

I have a list of product widgets, and we get the same product from different factories.  I want to know how many are duped accross which facttories

ProductName, FactoryName
Smith Widget, Factory1
Smith Widget, Factory2
Smith Widget, Factory3
Dave Widget, Factory1
Dave Widget, Factory4
Claire Widget, Factory1
Claire Widget, Factory2
Claire Widget, Factory3
Claire Widget, Factory4


A) What I want is a SQL statement that gives a list of those Widgets that are suppled from Factory1 and Factory3

So for Factory 1 and Factory 3
 
Product, 
Smith Widget,
Claire Widget 

B) What would be amazing is 

Name, Duplicates
&quot;Factory 1 &amp; Factory 2&quot;, 2 Dups
&quot;Factory 2 &amp; Factory 3&quot;, 2 Dups
&quot;Factory 1 &amp; Factory 3&quot;, 2 Dups
&quot;Factory 1 &amp; Factory 4&quot;, 1 Dups
&quot;Factory 2 &amp; Factory 4&quot;, 0 Dups
&quot;Factory 3 &amp; Factory 4&quot;, 1 Dups]]></description>
		<content:encoded><![CDATA[<p>Hi Guys, </p>
<p>I have a list of product widgets, and we get the same product from different factories.  I want to know how many are duped accross which facttories</p>
<p>ProductName, FactoryName<br />
Smith Widget, Factory1<br />
Smith Widget, Factory2<br />
Smith Widget, Factory3<br />
Dave Widget, Factory1<br />
Dave Widget, Factory4<br />
Claire Widget, Factory1<br />
Claire Widget, Factory2<br />
Claire Widget, Factory3<br />
Claire Widget, Factory4</p>
<p>A) What I want is a SQL statement that gives a list of those Widgets that are suppled from Factory1 and Factory3</p>
<p>So for Factory 1 and Factory 3</p>
<p>Product,<br />
Smith Widget,<br />
Claire Widget </p>
<p>B) What would be amazing is </p>
<p>Name, Duplicates<br />
&#8220;Factory 1 &amp; Factory 2&#8243;, 2 Dups<br />
&#8220;Factory 2 &amp; Factory 3&#8243;, 2 Dups<br />
&#8220;Factory 1 &amp; Factory 3&#8243;, 2 Dups<br />
&#8220;Factory 1 &amp; Factory 4&#8243;, 1 Dups<br />
&#8220;Factory 2 &amp; Factory 4&#8243;, 0 Dups<br />
&#8220;Factory 3 &amp; Factory 4&#8243;, 1 Dups</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ajay</title>
		<link>http://blog.sqlauthority.com/2007/07/11/sql-server-count-duplicate-records-rows/#comment-338705</link>
		<dc:creator><![CDATA[ajay]]></dc:creator>
		<pubDate>Wed, 29 Aug 2012 09:56:24 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/07/11/sql-server-count-duplicate-records-rows/#comment-338705</guid>
		<description><![CDATA[thanks sir]]></description>
		<content:encoded><![CDATA[<p>thanks sir</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: eric gerds</title>
		<link>http://blog.sqlauthority.com/2007/07/11/sql-server-count-duplicate-records-rows/#comment-330970</link>
		<dc:creator><![CDATA[eric gerds]]></dc:creator>
		<pubDate>Wed, 15 Aug 2012 17:31:39 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/07/11/sql-server-count-duplicate-records-rows/#comment-330970</guid>
		<description><![CDATA[I&#039;ll just leave this here

SELECT Field1, Field2, MIN(Field3) AS Min, MAX(Field3) AS Max, COUNT(*) AS TotalCount
FROM (SELECT Field1, Field2, Field3
	FROM Tablename
	WHERE [Criteria here]
	GROUP BY Field1, Field2, Field3) AS FilteredDetail
GROUP BY Field1, Field2
HAVING COUNT(*) &gt; 1
ORDER BY COUNT(*) DESC]]></description>
		<content:encoded><![CDATA[<p>I&#8217;ll just leave this here</p>
<p>SELECT Field1, Field2, MIN(Field3) AS Min, MAX(Field3) AS Max, COUNT(*) AS TotalCount<br />
FROM (SELECT Field1, Field2, Field3<br />
	FROM Tablename<br />
	WHERE [Criteria here]<br />
	GROUP BY Field1, Field2, Field3) AS FilteredDetail<br />
GROUP BY Field1, Field2<br />
HAVING COUNT(*) &gt; 1<br />
ORDER BY COUNT(*) DESC</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: madhivanan</title>
		<link>http://blog.sqlauthority.com/2007/07/11/sql-server-count-duplicate-records-rows/#comment-302818</link>
		<dc:creator><![CDATA[madhivanan]]></dc:creator>
		<pubDate>Mon, 18 Jun 2012 12:46:20 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/07/11/sql-server-count-duplicate-records-rows/#comment-302818</guid>
		<description><![CDATA[I have already replied to your question. Please check]]></description>
		<content:encoded><![CDATA[<p>I have already replied to your question. Please check</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: madhivanan</title>
		<link>http://blog.sqlauthority.com/2007/07/11/sql-server-count-duplicate-records-rows/#comment-302817</link>
		<dc:creator><![CDATA[madhivanan]]></dc:creator>
		<pubDate>Mon, 18 Jun 2012 12:45:37 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/07/11/sql-server-count-duplicate-records-rows/#comment-302817</guid>
		<description><![CDATA[Try this

select column1,column2,column3 from 
(
select *,row_number() over (partition by column1 order by column1) as sno from table
) as t
where sno=1]]></description>
		<content:encoded><![CDATA[<p>Try this</p>
<p>select column1,column2,column3 from<br />
(<br />
select *,row_number() over (partition by column1 order by column1) as sno from table<br />
) as t<br />
where sno=1</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Prakash Paranjape</title>
		<link>http://blog.sqlauthority.com/2007/07/11/sql-server-count-duplicate-records-rows/#comment-301123</link>
		<dc:creator><![CDATA[Prakash Paranjape]]></dc:creator>
		<pubDate>Thu, 14 Jun 2012 10:24:47 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/07/11/sql-server-count-duplicate-records-rows/#comment-301123</guid>
		<description><![CDATA[Mr. Pinal,

Request you to take some time from your busy schedule to provide the guidelines (Solution) for my query above.

Thanks]]></description>
		<content:encoded><![CDATA[<p>Mr. Pinal,</p>
<p>Request you to take some time from your busy schedule to provide the guidelines (Solution) for my query above.</p>
<p>Thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mehul</title>
		<link>http://blog.sqlauthority.com/2007/07/11/sql-server-count-duplicate-records-rows/#comment-300182</link>
		<dc:creator><![CDATA[mehul]]></dc:creator>
		<pubDate>Tue, 12 Jun 2012 02:53:36 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/07/11/sql-server-count-duplicate-records-rows/#comment-300182</guid>
		<description><![CDATA[Hi i have to required following solution for total no. of records

id            Created date

12343     05/15/2012
12345     05/15/2012
12121     05/16/2012
12369     05/19/2012
12371     05/19/2012
12343     05/22/2012
12888     05/22/2012 
12411     05/25/2012
12121     06/06/2012
12125     06/06/2012


Total Record  Create Date
2                      05/15/2012
1                      05/16/2012
2                      05/19/2012
1                      05/22/2012 (Repeat ID 12343 so not count that id)
1                      05/25/2012
1                      06/06/2012 (Repeat ID 121121 so not count that id)]]></description>
		<content:encoded><![CDATA[<p>Hi i have to required following solution for total no. of records</p>
<p>id            Created date</p>
<p>12343     05/15/2012<br />
12345     05/15/2012<br />
12121     05/16/2012<br />
12369     05/19/2012<br />
12371     05/19/2012<br />
12343     05/22/2012<br />
12888     05/22/2012<br />
12411     05/25/2012<br />
12121     06/06/2012<br />
12125     06/06/2012</p>
<p>Total Record  Create Date<br />
2                      05/15/2012<br />
1                      05/16/2012<br />
2                      05/19/2012<br />
1                      05/22/2012 (Repeat ID 12343 so not count that id)<br />
1                      05/25/2012<br />
1                      06/06/2012 (Repeat ID 121121 so not count that id)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Prakash Paranjape</title>
		<link>http://blog.sqlauthority.com/2007/07/11/sql-server-count-duplicate-records-rows/#comment-293593</link>
		<dc:creator><![CDATA[Prakash Paranjape]]></dc:creator>
		<pubDate>Mon, 04 Jun 2012 05:31:49 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/07/11/sql-server-count-duplicate-records-rows/#comment-293593</guid>
		<description><![CDATA[Hi Pinal,

Can you help me by providing the solution to my above query. It is some what urgent. Please...]]></description>
		<content:encoded><![CDATA[<p>Hi Pinal,</p>
<p>Can you help me by providing the solution to my above query. It is some what urgent. Please&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Prakash Paranjape</title>
		<link>http://blog.sqlauthority.com/2007/07/11/sql-server-count-duplicate-records-rows/#comment-292087</link>
		<dc:creator><![CDATA[Prakash Paranjape]]></dc:creator>
		<pubDate>Fri, 01 Jun 2012 07:30:31 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/07/11/sql-server-count-duplicate-records-rows/#comment-292087</guid>
		<description><![CDATA[Hi,
The output of my query contains duplicate records (i.e. column1 value is similar but other column&#039;s value different) as well as single record having column2 value blanks(-). now I want to select only one record out of duplicate records for which column2 values are present (eliminating records for which column2 is blanks(-) from duplicate records) and all other single records having column2 values blanks. 

My query&#039;s Present Output 
column1      column2        column3
abc          xyz            pqr
abc           -             klm
ijk           -             uvw
plo           -             ujn
yhk          ttg            wea
yhk           -             erf

Expected Output
column1      column2        column3
abc          xyz            pqr
ijk           -             uvw
plo           -             ujn
yhk          ttg            wea

Can someone help me. Thanks in advance.]]></description>
		<content:encoded><![CDATA[<p>Hi,<br />
The output of my query contains duplicate records (i.e. column1 value is similar but other column&#8217;s value different) as well as single record having column2 value blanks(-). now I want to select only one record out of duplicate records for which column2 values are present (eliminating records for which column2 is blanks(-) from duplicate records) and all other single records having column2 values blanks. </p>
<p>My query&#8217;s Present Output<br />
column1      column2        column3<br />
abc          xyz            pqr<br />
abc           &#8211;             klm<br />
ijk           &#8211;             uvw<br />
plo           &#8211;             ujn<br />
yhk          ttg            wea<br />
yhk           &#8211;             erf</p>
<p>Expected Output<br />
column1      column2        column3<br />
abc          xyz            pqr<br />
ijk           &#8211;             uvw<br />
plo           &#8211;             ujn<br />
yhk          ttg            wea</p>
<p>Can someone help me. Thanks in advance.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: K. Maynard</title>
		<link>http://blog.sqlauthority.com/2007/07/11/sql-server-count-duplicate-records-rows/#comment-291682</link>
		<dc:creator><![CDATA[K. Maynard]]></dc:creator>
		<pubDate>Thu, 31 May 2012 16:34:32 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/07/11/sql-server-count-duplicate-records-rows/#comment-291682</guid>
		<description><![CDATA[Good day everyone. I&#039;m hoping that someone can help me with my issue. I have duplicate values that I am searching for and while I can easily search for and find those, I can&#039;t figure out how to validate the first record while invalidating the others. So lets say I have the following fields:

Q_ID, Q_Status_CD, Q_MatchKey, Q_Fulfilled

I want to find all records with more than one matching Matchkey so I can use:

SELECT  Q_ID, Q_Status_CD, Q_MatchKey, Q_Fulfilled_DT
FROM MyTable
WHERE Q_Fulfilled_DT Is NULL
Having Count(Q_Matchkey) &gt; 1

This works fine for showing all duplicates. Where I am struggling is that I need to update the Q_FULFILLED_DT field on the FIRST entry with a date as well as set the Q_STATUS_CD = 1 (valid), then on all other records set the Q_STATUS_CD = 2 (in-valid). I found a work around to do this by first setting all duplicates to invalid, then finding the duplicates and by using MIN(Q_ID) to isolate the first record and then I reset the Status and Fulfilled date fields on that individual record.

This solution would be fine, except this is part of a weekly SQL job and it resets all duplicates each week and therefore places a duplicate order for that first record each week by changing the fulfilled date to the current week. I want to only update the first record when there isn&#039;t one with a Fulfilled date already in the duplicate set. I&#039;m not sure if this makes sense.]]></description>
		<content:encoded><![CDATA[<p>Good day everyone. I&#8217;m hoping that someone can help me with my issue. I have duplicate values that I am searching for and while I can easily search for and find those, I can&#8217;t figure out how to validate the first record while invalidating the others. So lets say I have the following fields:</p>
<p>Q_ID, Q_Status_CD, Q_MatchKey, Q_Fulfilled</p>
<p>I want to find all records with more than one matching Matchkey so I can use:</p>
<p>SELECT  Q_ID, Q_Status_CD, Q_MatchKey, Q_Fulfilled_DT<br />
FROM MyTable<br />
WHERE Q_Fulfilled_DT Is NULL<br />
Having Count(Q_Matchkey) &gt; 1</p>
<p>This works fine for showing all duplicates. Where I am struggling is that I need to update the Q_FULFILLED_DT field on the FIRST entry with a date as well as set the Q_STATUS_CD = 1 (valid), then on all other records set the Q_STATUS_CD = 2 (in-valid). I found a work around to do this by first setting all duplicates to invalid, then finding the duplicates and by using MIN(Q_ID) to isolate the first record and then I reset the Status and Fulfilled date fields on that individual record.</p>
<p>This solution would be fine, except this is part of a weekly SQL job and it resets all duplicates each week and therefore places a duplicate order for that first record each week by changing the fulfilled date to the current week. I want to only update the first record when there isn&#8217;t one with a Fulfilled date already in the duplicate set. I&#8217;m not sure if this makes sense.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ms Sida</title>
		<link>http://blog.sqlauthority.com/2007/07/11/sql-server-count-duplicate-records-rows/#comment-284704</link>
		<dc:creator><![CDATA[Ms Sida]]></dc:creator>
		<pubDate>Tue, 15 May 2012 07:18:36 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/07/11/sql-server-count-duplicate-records-rows/#comment-284704</guid>
		<description><![CDATA[sir, i want to delete all employee details except for two employee no in the database. I have tried this one but it delete all the data..

Delete from  Employee_Profile where EmpNo NOT IN 
(select EmpNo from Boss_Employee_Profile 
where EmpNo =&#039;21097&#039; , &#039;21097A&#039;)]]></description>
		<content:encoded><![CDATA[<p>sir, i want to delete all employee details except for two employee no in the database. I have tried this one but it delete all the data..</p>
<p>Delete from  Employee_Profile where EmpNo NOT IN<br />
(select EmpNo from Boss_Employee_Profile<br />
where EmpNo =&#8217;21097&#8242; , &#8217;21097A&#8217;)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Antonio Reynaldos</title>
		<link>http://blog.sqlauthority.com/2007/07/11/sql-server-count-duplicate-records-rows/#comment-267743</link>
		<dc:creator><![CDATA[Antonio Reynaldos]]></dc:creator>
		<pubDate>Mon, 26 Mar 2012 08:53:19 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/07/11/sql-server-count-duplicate-records-rows/#comment-267743</guid>
		<description><![CDATA[Most of the time, is not the problem to find a duplicate record (in a good designed database, you should NOT have a duplications).

Sometimes, you need to find out a given column is duplicated for a given other column: if you have different values for the same value
 (mostly a foreign key).

In this case, you count a nested select:

SELECT	ID, COUNT(field) AS duplicate
FROM	(SELECT DISTINCT ID, field
FROM          Table) s
GROUP BY ID
HAVING      (COUNT(field) &gt; 1)]]></description>
		<content:encoded><![CDATA[<p>Most of the time, is not the problem to find a duplicate record (in a good designed database, you should NOT have a duplications).</p>
<p>Sometimes, you need to find out a given column is duplicated for a given other column: if you have different values for the same value<br />
 (mostly a foreign key).</p>
<p>In this case, you count a nested select:</p>
<p>SELECT	ID, COUNT(field) AS duplicate<br />
FROM	(SELECT DISTINCT ID, field<br />
FROM          Table) s<br />
GROUP BY ID<br />
HAVING      (COUNT(field) &gt; 1)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: madhivanan</title>
		<link>http://blog.sqlauthority.com/2007/07/11/sql-server-count-duplicate-records-rows/#comment-265212</link>
		<dc:creator><![CDATA[madhivanan]]></dc:creator>
		<pubDate>Tue, 20 Mar 2012 07:54:08 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/07/11/sql-server-count-duplicate-records-rows/#comment-265212</guid>
		<description><![CDATA[select item, subinventory, locator, quantity/(count(*) over (partition by item)) from table]]></description>
		<content:encoded><![CDATA[<p>select item, subinventory, locator, quantity/(count(*) over (partition by item)) from table</p>
]]></content:encoded>
	</item>
</channel>
</rss>
