<?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; DISTINCT Keyword Usage and Common Discussion</title>
	<atom:link href="http://blog.sqlauthority.com/2007/12/20/sql-server-distinct-keyword-usage-and-common-discussion/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.sqlauthority.com/2007/12/20/sql-server-distinct-keyword-usage-and-common-discussion/</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: Sanjay Monpara</title>
		<link>http://blog.sqlauthority.com/2007/12/20/sql-server-distinct-keyword-usage-and-common-discussion/#comment-424433</link>
		<dc:creator><![CDATA[Sanjay Monpara]]></dc:creator>
		<pubDate>Wed, 20 Feb 2013 14:28:43 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/12/20/sql-server-distinct-keyword-usage-and-common-discussion/#comment-424433</guid>
		<description><![CDATA[SELECT b.Roles, a.FirstName, a.LastName
FROM UserNames a
	inner JOIN (SELECT DISTINCT roles from usernames) b ON a.roles = b.roles]]></description>
		<content:encoded><![CDATA[<p>SELECT b.Roles, a.FirstName, a.LastName<br />
FROM UserNames a<br />
	inner JOIN (SELECT DISTINCT roles from usernames) b ON a.roles = b.roles</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SQL SERVER &#8211; Weekly Series &#8211; Memory Lane &#8211; #008 &#171; SQL Server Journey with SQL Authority</title>
		<link>http://blog.sqlauthority.com/2007/12/20/sql-server-distinct-keyword-usage-and-common-discussion/#comment-397380</link>
		<dc:creator><![CDATA[SQL SERVER &#8211; Weekly Series &#8211; Memory Lane &#8211; #008 &#171; SQL Server Journey with SQL Authority]]></dc:creator>
		<pubDate>Sat, 22 Dec 2012 01:31:38 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/12/20/sql-server-distinct-keyword-usage-and-common-discussion/#comment-397380</guid>
		<description><![CDATA[[...] DISTINCT Keyword Usage and Common Discussion Jr. DBA asked me a day ago, how to apply DISTINCT keyword to only first column of SELECT. Distinct can not be applied to only few columns it is always applied to the whole column. This is one of the very interesting discussion I had in my early career. [...]]]></description>
		<content:encoded><![CDATA[<p>[...] DISTINCT Keyword Usage and Common Discussion Jr. DBA asked me a day ago, how to apply DISTINCT keyword to only first column of SELECT. Distinct can not be applied to only few columns it is always applied to the whole column. This is one of the very interesting discussion I had in my early career. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: madhivanan</title>
		<link>http://blog.sqlauthority.com/2007/12/20/sql-server-distinct-keyword-usage-and-common-discussion/#comment-374440</link>
		<dc:creator><![CDATA[madhivanan]]></dc:creator>
		<pubDate>Thu, 15 Nov 2012 11:26:52 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/12/20/sql-server-distinct-keyword-usage-and-common-discussion/#comment-374440</guid>
		<description><![CDATA[select col1, col2, max(col3) as col3 from table
group by col1,col2]]></description>
		<content:encoded><![CDATA[<p>select col1, col2, max(col3) as col3 from table<br />
group by col1,col2</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kappy</title>
		<link>http://blog.sqlauthority.com/2007/12/20/sql-server-distinct-keyword-usage-and-common-discussion/#comment-357243</link>
		<dc:creator><![CDATA[Kappy]]></dc:creator>
		<pubDate>Mon, 08 Oct 2012 08:40:40 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/12/20/sql-server-distinct-keyword-usage-and-common-discussion/#comment-357243</guid>
		<description><![CDATA[Hi ,

I want sql querys for following scenarios

Owner of the company  wants to create 5 users,3 in following fashion
1) 2 -Must have authority of admin
2) 2- Normal user
3) 1 - User whose password is blocked for 15 days]]></description>
		<content:encoded><![CDATA[<p>Hi ,</p>
<p>I want sql querys for following scenarios</p>
<p>Owner of the company  wants to create 5 users,3 in following fashion<br />
1) 2 -Must have authority of admin<br />
2) 2- Normal user<br />
3) 1 &#8211; User whose password is blocked for 15 days</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Abhishek Majumder</title>
		<link>http://blog.sqlauthority.com/2007/12/20/sql-server-distinct-keyword-usage-and-common-discussion/#comment-354245</link>
		<dc:creator><![CDATA[Abhishek Majumder]]></dc:creator>
		<pubDate>Sat, 29 Sep 2012 15:17:34 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/12/20/sql-server-distinct-keyword-usage-and-common-discussion/#comment-354245</guid>
		<description><![CDATA[I have 4 result looks like
ram      10  1001
ram      10  1002
shyam  30  5431
shyam  30  5567

now i have to select only 2nd and 4th row
how to do it?]]></description>
		<content:encoded><![CDATA[<p>I have 4 result looks like<br />
ram      10  1001<br />
ram      10  1002<br />
shyam  30  5431<br />
shyam  30  5567</p>
<p>now i have to select only 2nd and 4th row<br />
how to do it?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: madhivanan</title>
		<link>http://blog.sqlauthority.com/2007/12/20/sql-server-distinct-keyword-usage-and-common-discussion/#comment-287525</link>
		<dc:creator><![CDATA[madhivanan]]></dc:creator>
		<pubDate>Wed, 23 May 2012 10:19:44 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/12/20/sql-server-distinct-keyword-usage-and-common-discussion/#comment-287525</guid>
		<description><![CDATA[You need to either exclude other columns, or use aggregate functions like min or mx on other columns]]></description>
		<content:encoded><![CDATA[<p>You need to either exclude other columns, or use aggregate functions like min or mx on other columns</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: madhivanan</title>
		<link>http://blog.sqlauthority.com/2007/12/20/sql-server-distinct-keyword-usage-and-common-discussion/#comment-287512</link>
		<dc:creator><![CDATA[madhivanan]]></dc:creator>
		<pubDate>Wed, 23 May 2012 10:04:56 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/12/20/sql-server-distinct-keyword-usage-and-common-discussion/#comment-287512</guid>
		<description><![CDATA[In some cases they do the same thing and not all the cases. They exists for different purposes]]></description>
		<content:encoded><![CDATA[<p>In some cases they do the same thing and not all the cases. They exists for different purposes</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: prasanna</title>
		<link>http://blog.sqlauthority.com/2007/12/20/sql-server-distinct-keyword-usage-and-common-discussion/#comment-286560</link>
		<dc:creator><![CDATA[prasanna]]></dc:creator>
		<pubDate>Sun, 20 May 2012 18:38:45 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/12/20/sql-server-distinct-keyword-usage-and-common-discussion/#comment-286560</guid>
		<description><![CDATA[If GROUP BY can do same work as DISTINCT then why DISTINCT is needed.]]></description>
		<content:encoded><![CDATA[<p>If GROUP BY can do same work as DISTINCT then why DISTINCT is needed.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chinmoy</title>
		<link>http://blog.sqlauthority.com/2007/12/20/sql-server-distinct-keyword-usage-and-common-discussion/#comment-285732</link>
		<dc:creator><![CDATA[Chinmoy]]></dc:creator>
		<pubDate>Fri, 18 May 2012 10:51:57 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/12/20/sql-server-distinct-keyword-usage-and-common-discussion/#comment-285732</guid>
		<description><![CDATA[I need result by using DISTINCT for one column only, not whole row then how to proceed.]]></description>
		<content:encoded><![CDATA[<p>I need result by using DISTINCT for one column only, not whole row then how to proceed.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Veeresh</title>
		<link>http://blog.sqlauthority.com/2007/12/20/sql-server-distinct-keyword-usage-and-common-discussion/#comment-206430</link>
		<dc:creator><![CDATA[Veeresh]]></dc:creator>
		<pubDate>Mon, 28 Nov 2011 11:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/12/20/sql-server-distinct-keyword-usage-and-common-discussion/#comment-206430</guid>
		<description><![CDATA[shal i use..Distinct(Columname) like this]]></description>
		<content:encoded><![CDATA[<p>shal i use..Distinct(Columname) like this</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Christof Coetzee</title>
		<link>http://blog.sqlauthority.com/2007/12/20/sql-server-distinct-keyword-usage-and-common-discussion/#comment-198498</link>
		<dc:creator><![CDATA[Christof Coetzee]]></dc:creator>
		<pubDate>Fri, 18 Nov 2011 11:11:32 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/12/20/sql-server-distinct-keyword-usage-and-common-discussion/#comment-198498</guid>
		<description><![CDATA[Hawing worked extensively with MySQL and only about 2 years on Sql Server I have encountered a lot of headaches with Sql Server&#039;s group-by, distinct and in general to get UNIQUE ROWS on joins.
The fact that you have to include all columns in a group-by is just silly and I think Sql Server is perhaps not as intelligent as MySql in its query plans.

In Sql Server the way to get recordsets for pagination is also unnecessarily complex TOP X and order-by, OVER PARTITION etc is ridiculous, in MySQL its as simple as LIMIT offset count.]]></description>
		<content:encoded><![CDATA[<p>Hawing worked extensively with MySQL and only about 2 years on Sql Server I have encountered a lot of headaches with Sql Server&#8217;s group-by, distinct and in general to get UNIQUE ROWS on joins.<br />
The fact that you have to include all columns in a group-by is just silly and I think Sql Server is perhaps not as intelligent as MySql in its query plans.</p>
<p>In Sql Server the way to get recordsets for pagination is also unnecessarily complex TOP X and order-by, OVER PARTITION etc is ridiculous, in MySQL its as simple as LIMIT offset count.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: madhivanan</title>
		<link>http://blog.sqlauthority.com/2007/12/20/sql-server-distinct-keyword-usage-and-common-discussion/#comment-154076</link>
		<dc:creator><![CDATA[madhivanan]]></dc:creator>
		<pubDate>Fri, 05 Aug 2011 10:05:39 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/12/20/sql-server-distinct-keyword-usage-and-common-discussion/#comment-154076</guid>
		<description><![CDATA[Can you post the code you have used? If you used group by clause, you dont need a distinct clause]]></description>
		<content:encoded><![CDATA[<p>Can you post the code you have used? If you used group by clause, you dont need a distinct clause</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Shirish Kulkarni</title>
		<link>http://blog.sqlauthority.com/2007/12/20/sql-server-distinct-keyword-usage-and-common-discussion/#comment-154045</link>
		<dc:creator><![CDATA[Shirish Kulkarni]]></dc:creator>
		<pubDate>Fri, 05 Aug 2011 08:41:06 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/12/20/sql-server-distinct-keyword-usage-and-common-discussion/#comment-154045</guid>
		<description><![CDATA[As distinct clause affects performance of the application. What is the better option to DISTINCT clause. In T- SQL only.]]></description>
		<content:encoded><![CDATA[<p>As distinct clause affects performance of the application. What is the better option to DISTINCT clause. In T- SQL only.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: AndresP</title>
		<link>http://blog.sqlauthority.com/2007/12/20/sql-server-distinct-keyword-usage-and-common-discussion/#comment-111757</link>
		<dc:creator><![CDATA[AndresP]]></dc:creator>
		<pubDate>Tue, 18 Jan 2011 18:19:22 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/12/20/sql-server-distinct-keyword-usage-and-common-discussion/#comment-111757</guid>
		<description><![CDATA[I have

select distinct a,b,c,database from
(
select a,b,c,&#039;A&#039; as database from tableA
union
select a,b,c,&#039;B&#039; as database from tableB
) as Everything

with tableA and tableB having lots of data in common, and I expect this query to give all the rows with different value of a.

Where&#039;s the logical error? Is there any way to have this simple query done in SQLServer?]]></description>
		<content:encoded><![CDATA[<p>I have</p>
<p>select distinct a,b,c,database from<br />
(<br />
select a,b,c,&#8217;A&#8217; as database from tableA<br />
union<br />
select a,b,c,&#8217;B&#8217; as database from tableB<br />
) as Everything</p>
<p>with tableA and tableB having lots of data in common, and I expect this query to give all the rows with different value of a.</p>
<p>Where&#8217;s the logical error? Is there any way to have this simple query done in SQLServer?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Prithviraj MK</title>
		<link>http://blog.sqlauthority.com/2007/12/20/sql-server-distinct-keyword-usage-and-common-discussion/#comment-83591</link>
		<dc:creator><![CDATA[Prithviraj MK]]></dc:creator>
		<pubDate>Tue, 10 Aug 2010 12:42:11 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/12/20/sql-server-distinct-keyword-usage-and-common-discussion/#comment-83591</guid>
		<description><![CDATA[Hi,

I would like to know wether the distinct can be applied to each column in a table or not... if so can you please 
explain..

e.g.

I have a table containing a firstname, lastname, salary, designation, dob, doj,

----
I would like to apply distinct keyword for all the column in a table.

Thanks in Advance,
Prithviraj MK]]></description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>I would like to know wether the distinct can be applied to each column in a table or not&#8230; if so can you please<br />
explain..</p>
<p>e.g.</p>
<p>I have a table containing a firstname, lastname, salary, designation, dob, doj,</p>
<p>&#8212;-<br />
I would like to apply distinct keyword for all the column in a table.</p>
<p>Thanks in Advance,<br />
Prithviraj MK</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Edolmen Sviluppo Siti Web</title>
		<link>http://blog.sqlauthority.com/2007/12/20/sql-server-distinct-keyword-usage-and-common-discussion/#comment-74090</link>
		<dc:creator><![CDATA[Edolmen Sviluppo Siti Web]]></dc:creator>
		<pubDate>Tue, 01 Jun 2010 09:18:45 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/12/20/sql-server-distinct-keyword-usage-and-common-discussion/#comment-74090</guid>
		<description><![CDATA[I’m actually working on a sample of 100 records from a 10,000 record table. The table has the following columns ( ID, PayerID, Category, Status, CreateDate )

In my  file I need to have a 100 records with all the columns but each record should have a DISTINCT PayerID.
How would I do that ?]]></description>
		<content:encoded><![CDATA[<p>I’m actually working on a sample of 100 records from a 10,000 record table. The table has the following columns ( ID, PayerID, Category, Status, CreateDate )</p>
<p>In my  file I need to have a 100 records with all the columns but each record should have a DISTINCT PayerID.<br />
How would I do that ?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tejas Shah</title>
		<link>http://blog.sqlauthority.com/2007/12/20/sql-server-distinct-keyword-usage-and-common-discussion/#comment-65906</link>
		<dc:creator><![CDATA[Tejas Shah]]></dc:creator>
		<pubDate>Wed, 21 Apr 2010 10:37:00 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/12/20/sql-server-distinct-keyword-usage-and-common-discussion/#comment-65906</guid>
		<description><![CDATA[Hi Shaf,

If you are using SQL 2005 and above, you can use following:

;with cte as(
SELECT  Row_NUMBER() OVER(PARTITION BY Person ORDER BY Person) AS RowID,
*
from table
)
select * 
from cte
where RowID &gt; 1

It will list out all records that you need to delete. If you are sure that you can delete this. use this query:

;with cte as(
SELECT  Row_NUMBER() OVER(PARTITION BY Person ORDER BY Person) AS RowID,
*
from table
)
DELETE
from cte
where RowID &gt; 1

For more information: http://www.sqlyoga.com/2009/03/sql-server-find-duplicate-rows-with.html

Thanks,
Tejas]]></description>
		<content:encoded><![CDATA[<p>Hi Shaf,</p>
<p>If you are using SQL 2005 and above, you can use following:</p>
<p>;with cte as(<br />
SELECT  Row_NUMBER() OVER(PARTITION BY Person ORDER BY Person) AS RowID,<br />
*<br />
from table<br />
)<br />
select *<br />
from cte<br />
where RowID &gt; 1</p>
<p>It will list out all records that you need to delete. If you are sure that you can delete this. use this query:</p>
<p>;with cte as(<br />
SELECT  Row_NUMBER() OVER(PARTITION BY Person ORDER BY Person) AS RowID,<br />
*<br />
from table<br />
)<br />
DELETE<br />
from cte<br />
where RowID &gt; 1</p>
<p>For more information: <a href="http://www.sqlyoga.com/2009/03/sql-server-find-duplicate-rows-with.html" rel="nofollow">http://www.sqlyoga.com/2009/03/sql-server-find-duplicate-rows-with.html</a></p>
<p>Thanks,<br />
Tejas</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: shaf</title>
		<link>http://blog.sqlauthority.com/2007/12/20/sql-server-distinct-keyword-usage-and-common-discussion/#comment-65880</link>
		<dc:creator><![CDATA[shaf]]></dc:creator>
		<pubDate>Wed, 21 Apr 2010 08:05:57 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/12/20/sql-server-distinct-keyword-usage-and-common-discussion/#comment-65880</guid>
		<description><![CDATA[and one more thing here is in this table their is no autonumber or primary key,

i have to select only one person record and delet his duplicate entries ... that person records at a time]]></description>
		<content:encoded><![CDATA[<p>and one more thing here is in this table their is no autonumber or primary key,</p>
<p>i have to select only one person record and delet his duplicate entries &#8230; that person records at a time</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: shaf</title>
		<link>http://blog.sqlauthority.com/2007/12/20/sql-server-distinct-keyword-usage-and-common-discussion/#comment-65871</link>
		<dc:creator><![CDATA[shaf]]></dc:creator>
		<pubDate>Wed, 21 Apr 2010 06:59:06 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/12/20/sql-server-distinct-keyword-usage-and-common-discussion/#comment-65871</guid>
		<description><![CDATA[How to select only one category of dupliacte records and delete that excluding one ...
for example consider in my DB table i have 200 records
in that i have more that one person duplicate records, now
i want to delete one user duplicate records.
that is if person one has entered his data 5 times with same details, i have to check that and have to delete 4 record of that person and keep one record... i may have more than one person records in that way in same table]]></description>
		<content:encoded><![CDATA[<p>How to select only one category of dupliacte records and delete that excluding one &#8230;<br />
for example consider in my DB table i have 200 records<br />
in that i have more that one person duplicate records, now<br />
i want to delete one user duplicate records.<br />
that is if person one has entered his data 5 times with same details, i have to check that and have to delete 4 record of that person and keep one record&#8230; i may have more than one person records in that way in same table</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Imran Mohammed</title>
		<link>http://blog.sqlauthority.com/2007/12/20/sql-server-distinct-keyword-usage-and-common-discussion/#comment-52041</link>
		<dc:creator><![CDATA[Imran Mohammed]]></dc:creator>
		<pubDate>Tue, 19 May 2009 04:04:44 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/12/20/sql-server-distinct-keyword-usage-and-common-discussion/#comment-52041</guid>
		<description><![CDATA[@Kinara, 

Need more details. 

Do you have duplicate records for the same PayerID with different combinations of ID&lt; Category, Status and CreateDate. If there exusts multiple records for same PayerID, I dont think, you can achieve your tasks by a simple select statement. 

Please provide some sample data.

Input and what kind of output you are expecting.

~ IM.]]></description>
		<content:encoded><![CDATA[<p>@Kinara, </p>
<p>Need more details. </p>
<p>Do you have duplicate records for the same PayerID with different combinations of ID&lt; Category, Status and CreateDate. If there exusts multiple records for same PayerID, I dont think, you can achieve your tasks by a simple select statement. </p>
<p>Please provide some sample data.</p>
<p>Input and what kind of output you are expecting.</p>
<p>~ IM.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kinara</title>
		<link>http://blog.sqlauthority.com/2007/12/20/sql-server-distinct-keyword-usage-and-common-discussion/#comment-52027</link>
		<dc:creator><![CDATA[Kinara]]></dc:creator>
		<pubDate>Mon, 18 May 2009 22:11:50 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/12/20/sql-server-distinct-keyword-usage-and-common-discussion/#comment-52027</guid>
		<description><![CDATA[I&#039;m surprised at your statement about &quot; logical error in thinking query like that... &quot;

I have a situation where I&#039;m asked for a sample of 100 records from a 10,000 record table. The table has the following columns ( ID, PayerID, Category, Status, CreateDate )

In my Sample file I need to have a 100 records with all the columns but each record should have a DISTINCT PayerID.

Explain to me please on how would you solve this? 


Thanx

Kinara]]></description>
		<content:encoded><![CDATA[<p>I&#8217;m surprised at your statement about &#8221; logical error in thinking query like that&#8230; &#8221;</p>
<p>I have a situation where I&#8217;m asked for a sample of 100 records from a 10,000 record table. The table has the following columns ( ID, PayerID, Category, Status, CreateDate )</p>
<p>In my Sample file I need to have a 100 records with all the columns but each record should have a DISTINCT PayerID.</p>
<p>Explain to me please on how would you solve this? </p>
<p>Thanx</p>
<p>Kinara</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Imran Mohammed</title>
		<link>http://blog.sqlauthority.com/2007/12/20/sql-server-distinct-keyword-usage-and-common-discussion/#comment-50665</link>
		<dc:creator><![CDATA[Imran Mohammed]]></dc:creator>
		<pubDate>Wed, 08 Apr 2009 04:32:38 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/12/20/sql-server-distinct-keyword-usage-and-common-discussion/#comment-50665</guid>
		<description><![CDATA[@Naeem

One way to do that is use GROUP BY, But there is a serious problem with GROUP BY, which I hate saying but true, You have to include all the columns in GROUP BY clause what you have mentioned in SELECT clause. 

Anyways your best choice would be to use OVER PARTITION BY in your select query, this is a new feature in sql server 2005.

OVER PARTITION BY will serves your purpose. This is just like GROUP BY but here you have freedom to exclude columns that you do not want to include in GROUP BY clause.

GROUP BY is nothing but grouping or distinct (for that match of columns) in a way.

Find simple example of OVER PARTITION BY here, 

http://www.sqlteam.com/article/sql-sever-2005-using-over-with-aggregate-functions

~ IM.]]></description>
		<content:encoded><![CDATA[<p>@Naeem</p>
<p>One way to do that is use GROUP BY, But there is a serious problem with GROUP BY, which I hate saying but true, You have to include all the columns in GROUP BY clause what you have mentioned in SELECT clause. </p>
<p>Anyways your best choice would be to use OVER PARTITION BY in your select query, this is a new feature in sql server 2005.</p>
<p>OVER PARTITION BY will serves your purpose. This is just like GROUP BY but here you have freedom to exclude columns that you do not want to include in GROUP BY clause.</p>
<p>GROUP BY is nothing but grouping or distinct (for that match of columns) in a way.</p>
<p>Find simple example of OVER PARTITION BY here, </p>
<p><a href="http://www.sqlteam.com/article/sql-sever-2005-using-over-with-aggregate-functions" rel="nofollow">http://www.sqlteam.com/article/sql-sever-2005-using-over-with-aggregate-functions</a></p>
<p>~ IM.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Naeem</title>
		<link>http://blog.sqlauthority.com/2007/12/20/sql-server-distinct-keyword-usage-and-common-discussion/#comment-50652</link>
		<dc:creator><![CDATA[Naeem]]></dc:creator>
		<pubDate>Tue, 07 Apr 2009 23:34:23 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/12/20/sql-server-distinct-keyword-usage-and-common-discussion/#comment-50652</guid>
		<description><![CDATA[Hi, 

I have a similar problem but cant fix it can you please help me, problem is:

I have a table with following columns: basketid, lookup_value, date_time.
 
I only want to return distinct basketid and lookup value rows and also want to include date_time row as well. but it is not distinct. any solutions please. Group by and distinct does not solve my problem.

Thank you]]></description>
		<content:encoded><![CDATA[<p>Hi, </p>
<p>I have a similar problem but cant fix it can you please help me, problem is:</p>
<p>I have a table with following columns: basketid, lookup_value, date_time.</p>
<p>I only want to return distinct basketid and lookup value rows and also want to include date_time row as well. but it is not distinct. any solutions please. Group by and distinct does not solve my problem.</p>
<p>Thank you</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: parthiban</title>
		<link>http://blog.sqlauthority.com/2007/12/20/sql-server-distinct-keyword-usage-and-common-discussion/#comment-43527</link>
		<dc:creator><![CDATA[parthiban]]></dc:creator>
		<pubDate>Mon, 06 Oct 2008 07:08:24 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/12/20/sql-server-distinct-keyword-usage-and-common-discussion/#comment-43527</guid>
		<description><![CDATA[h i
 using stored produce  i want to remove the  duplicate value in the single colums]]></description>
		<content:encoded><![CDATA[<p>h i<br />
 using stored produce  i want to remove the  duplicate value in the single colums</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steven</title>
		<link>http://blog.sqlauthority.com/2007/12/20/sql-server-distinct-keyword-usage-and-common-discussion/#comment-42355</link>
		<dc:creator><![CDATA[Steven]]></dc:creator>
		<pubDate>Wed, 03 Sep 2008 09:07:56 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/12/20/sql-server-distinct-keyword-usage-and-common-discussion/#comment-42355</guid>
		<description><![CDATA[It seems to me that M$ SQL Server cannot &quot;GROUP BY&quot; one column of a result set, nor can it select only &quot;DISTINCT&quot; values of one column of the result set.

MySQL can easily do this with the following code: 
&quot;SELECT DISTINCT Roles, FirstName, LastName FROM UserNames&quot;]]></description>
		<content:encoded><![CDATA[<p>It seems to me that M$ SQL Server cannot &#8220;GROUP BY&#8221; one column of a result set, nor can it select only &#8220;DISTINCT&#8221; values of one column of the result set.</p>
<p>MySQL can easily do this with the following code:<br />
&#8220;SELECT DISTINCT Roles, FirstName, LastName FROM UserNames&#8221;</p>
]]></content:encoded>
	</item>
</channel>
</rss>
