<?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; Difference between DISTINCT and GROUP BY &#8211; Distinct vs Group By</title>
	<atom:link href="http://blog.sqlauthority.com/2007/03/29/sql-server-difference-between-distinct-and-group-by-distinct-vs-group-by/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.sqlauthority.com/2007/03/29/sql-server-difference-between-distinct-and-group-by-distinct-vs-group-by/</link>
	<description>Notes of a SQL Server MVP and Database Administrator</description>
	<lastBuildDate>Fri, 20 Nov 2009 20:17:18 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Asharaf Ali</title>
		<link>http://blog.sqlauthority.com/2007/03/29/sql-server-difference-between-distinct-and-group-by-distinct-vs-group-by/#comment-57759</link>
		<dc:creator>Asharaf Ali</dc:creator>
		<pubDate>Fri, 20 Nov 2009 05:26:51 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/03/29/difference-between-distinct-and-group-by-distinct-vs-group-by/#comment-57759</guid>
		<description>Thanks
useful info</description>
		<content:encoded><![CDATA[<p>Thanks<br />
useful info</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brian Tkatch</title>
		<link>http://blog.sqlauthority.com/2007/03/29/sql-server-difference-between-distinct-and-group-by-distinct-vs-group-by/#comment-57524</link>
		<dc:creator>Brian Tkatch</dc:creator>
		<pubDate>Wed, 11 Nov 2009 13:54:43 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/03/29/difference-between-distinct-and-group-by-distinct-vs-group-by/#comment-57524</guid>
		<description>@Lizbeth Morales

The query didn&#039;t seem to come through correctly.

Please repost it, along with the COLUMNs in each TABLE used. It is hard to determine what is going on without them.</description>
		<content:encoded><![CDATA[<p>@Lizbeth Morales</p>
<p>The query didn&#8217;t seem to come through correctly.</p>
<p>Please repost it, along with the COLUMNs in each TABLE used. It is hard to determine what is going on without them.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Lizbeth Morales</title>
		<link>http://blog.sqlauthority.com/2007/03/29/sql-server-difference-between-distinct-and-group-by-distinct-vs-group-by/#comment-57509</link>
		<dc:creator>Lizbeth Morales</dc:creator>
		<pubDate>Tue, 10 Nov 2009 23:40:45 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/03/29/difference-between-distinct-and-group-by-distinct-vs-group-by/#comment-57509</guid>
		<description>Hello I am trying to make a selection in 3 different tables using distinct, but I keep getting duplicate values, my tables are Alumni, History, and Groups, I get the id and name of students enrolled in the group 230, my query is

SELECT DISTINCT H. Go, A. LastName, A. Name FROM History H, Alumni A, Groups I WHERE Group = 230 AND H. H.id = I.id AND ORDER BY I.key = A.key H.id &quot; )

appear two students with the same value:

9876 M John
9876 M John

I hope you can help me as no way out, and I&#039;m starting to use SQL.</description>
		<content:encoded><![CDATA[<p>Hello I am trying to make a selection in 3 different tables using distinct, but I keep getting duplicate values, my tables are Alumni, History, and Groups, I get the id and name of students enrolled in the group 230, my query is</p>
<p>SELECT DISTINCT H. Go, A. LastName, A. Name FROM History H, Alumni A, Groups I WHERE Group = 230 AND H. H.id = I.id AND ORDER BY I.key = A.key H.id &#8221; )</p>
<p>appear two students with the same value:</p>
<p>9876 M John<br />
9876 M John</p>
<p>I hope you can help me as no way out, and I&#8217;m starting to use SQL.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Lakshmi S</title>
		<link>http://blog.sqlauthority.com/2007/03/29/sql-server-difference-between-distinct-and-group-by-distinct-vs-group-by/#comment-55427</link>
		<dc:creator>Lakshmi S</dc:creator>
		<pubDate>Mon, 31 Aug 2009 07:26:01 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/03/29/difference-between-distinct-and-group-by-distinct-vs-group-by/#comment-55427</guid>
		<description>Thanks Pinal.

Very useful posts.</description>
		<content:encoded><![CDATA[<p>Thanks Pinal.</p>
<p>Very useful posts.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: parthiban</title>
		<link>http://blog.sqlauthority.com/2007/03/29/sql-server-difference-between-distinct-and-group-by-distinct-vs-group-by/#comment-55053</link>
		<dc:creator>parthiban</dc:creator>
		<pubDate>Thu, 20 Aug 2009 12:00:41 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/03/29/difference-between-distinct-and-group-by-distinct-vs-group-by/#comment-55053</guid>
		<description>i try to get distinct values for name and get all other fields with out where condition

ex. table

id      name    level    department       companyid

1       ram        1           1                         1

2       ram         2          2                         2

3       kumar      3          3                         3

4       Raja         4           4                        4


i expect value is
1       ram        1           1                         1

3       kumar      3          3                         3

4       Raja         4           4                        4

                          (or)
1       ram        1           1                         1

2       ram         2          2                         2

4       Raja         4           4                        4</description>
		<content:encoded><![CDATA[<p>i try to get distinct values for name and get all other fields with out where condition</p>
<p>ex. table</p>
<p>id      name    level    department       companyid</p>
<p>1       ram        1           1                         1</p>
<p>2       ram         2          2                         2</p>
<p>3       kumar      3          3                         3</p>
<p>4       Raja         4           4                        4</p>
<p>i expect value is<br />
1       ram        1           1                         1</p>
<p>3       kumar      3          3                         3</p>
<p>4       Raja         4           4                        4</p>
<p>                          (or)<br />
1       ram        1           1                         1</p>
<p>2       ram         2          2                         2</p>
<p>4       Raja         4           4                        4</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: New techie Praveen</title>
		<link>http://blog.sqlauthority.com/2007/03/29/sql-server-difference-between-distinct-and-group-by-distinct-vs-group-by/#comment-53657</link>
		<dc:creator>New techie Praveen</dc:creator>
		<pubDate>Mon, 13 Jul 2009 09:20:17 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/03/29/difference-between-distinct-and-group-by-distinct-vs-group-by/#comment-53657</guid>
		<description>Thanks Pinal,

These posts are very useful.
I found them after attending your presentation in teched delhi.</description>
		<content:encoded><![CDATA[<p>Thanks Pinal,</p>
<p>These posts are very useful.<br />
I found them after attending your presentation in teched delhi.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: phani</title>
		<link>http://blog.sqlauthority.com/2007/03/29/sql-server-difference-between-distinct-and-group-by-distinct-vs-group-by/#comment-53598</link>
		<dc:creator>phani</dc:creator>
		<pubDate>Fri, 10 Jul 2009 09:14:38 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/03/29/difference-between-distinct-and-group-by-distinct-vs-group-by/#comment-53598</guid>
		<description>select DENSE_RANK() Over (Order by col1, col2 ) as Ranky, col1, col2 from table where... 
group By Col1, col2  -- gives distinct</description>
		<content:encoded><![CDATA[<p>select DENSE_RANK() Over (Order by col1, col2 ) as Ranky, col1, col2 from table where&#8230;<br />
group By Col1, col2  &#8212; gives distinct</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Shahid</title>
		<link>http://blog.sqlauthority.com/2007/03/29/sql-server-difference-between-distinct-and-group-by-distinct-vs-group-by/#comment-53036</link>
		<dc:creator>Shahid</dc:creator>
		<pubDate>Tue, 16 Jun 2009 08:56:47 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/03/29/difference-between-distinct-and-group-by-distinct-vs-group-by/#comment-53036</guid>
		<description>Dear 

Could u plz suggest me a technique where i can implement transactional replication technique with ONE - MANY Tables relationships........... i want to replicate the different remote databases with same name n having same articles and structures in centralized single database with same single articles....................</description>
		<content:encoded><![CDATA[<p>Dear </p>
<p>Could u plz suggest me a technique where i can implement transactional replication technique with ONE &#8211; MANY Tables relationships&#8230;&#8230;&#8230;.. i want to replicate the different remote databases with same name n having same articles and structures in centralized single database with same single articles&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;..</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kashif</title>
		<link>http://blog.sqlauthority.com/2007/03/29/sql-server-difference-between-distinct-and-group-by-distinct-vs-group-by/#comment-52923</link>
		<dc:creator>Kashif</dc:creator>
		<pubDate>Thu, 11 Jun 2009 04:43:50 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/03/29/difference-between-distinct-and-group-by-distinct-vs-group-by/#comment-52923</guid>
		<description>Hye!

I&#039;m trying a simple query with DISTINCT keyword as:

SELECT DISTINCT SecCode FROM Sections ORDER BY SecCode

in SQL Server 2005, but it is not giving me any result.

Can anyone help me?

Thanks!</description>
		<content:encoded><![CDATA[<p>Hye!</p>
<p>I&#8217;m trying a simple query with DISTINCT keyword as:</p>
<p>SELECT DISTINCT SecCode FROM Sections ORDER BY SecCode</p>
<p>in SQL Server 2005, but it is not giving me any result.</p>
<p>Can anyone help me?</p>
<p>Thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Suresh</title>
		<link>http://blog.sqlauthority.com/2007/03/29/sql-server-difference-between-distinct-and-group-by-distinct-vs-group-by/#comment-52527</link>
		<dc:creator>Suresh</dc:creator>
		<pubDate>Fri, 29 May 2009 05:38:20 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/03/29/difference-between-distinct-and-group-by-distinct-vs-group-by/#comment-52527</guid>
		<description>hi thanks so much for between dif but when and why used this arti........</description>
		<content:encoded><![CDATA[<p>hi thanks so much for between dif but when and why used this arti&#8230;&#8230;..</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: pinaldave</title>
		<link>http://blog.sqlauthority.com/2007/03/29/sql-server-difference-between-distinct-and-group-by-distinct-vs-group-by/#comment-51266</link>
		<dc:creator>pinaldave</dc:creator>
		<pubDate>Fri, 24 Apr 2009 12:49:50 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/03/29/difference-between-distinct-and-group-by-distinct-vs-group-by/#comment-51266</guid>
		<description>Thank you Ted</description>
		<content:encoded><![CDATA[<p>Thank you Ted</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ted Burrett</title>
		<link>http://blog.sqlauthority.com/2007/03/29/sql-server-difference-between-distinct-and-group-by-distinct-vs-group-by/#comment-51264</link>
		<dc:creator>Ted Burrett</dc:creator>
		<pubDate>Fri, 24 Apr 2009 11:09:58 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/03/29/difference-between-distinct-and-group-by-distinct-vs-group-by/#comment-51264</guid>
		<description>I read your posts for quite a long time and should tell   that your posts always prove to be of a high value and quality for readers.</description>
		<content:encoded><![CDATA[<p>I read your posts for quite a long time and should tell   that your posts always prove to be of a high value and quality for readers.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Imran Mohammed</title>
		<link>http://blog.sqlauthority.com/2007/03/29/sql-server-difference-between-distinct-and-group-by-distinct-vs-group-by/#comment-49392</link>
		<dc:creator>Imran Mohammed</dc:creator>
		<pubDate>Wed, 18 Mar 2009 11:13:55 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/03/29/difference-between-distinct-and-group-by-distinct-vs-group-by/#comment-49392</guid>
		<description>@shwaria

Remove comma (,) at the end of second line, to reduce confusion, you can use different column name.

select CurrentOperator, COUNT(*) Count_CurrentOperator from EZBusDB.dbo.Buses
GROUP BY CurrentOperator

~IM</description>
		<content:encoded><![CDATA[<p>@shwaria</p>
<p>Remove comma (,) at the end of second line, to reduce confusion, you can use different column name.</p>
<p>select CurrentOperator, COUNT(*) Count_CurrentOperator from EZBusDB.dbo.Buses<br />
GROUP BY CurrentOperator</p>
<p>~IM</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Saranda</title>
		<link>http://blog.sqlauthority.com/2007/03/29/sql-server-difference-between-distinct-and-group-by-distinct-vs-group-by/#comment-49388</link>
		<dc:creator>Saranda</dc:creator>
		<pubDate>Wed, 18 Mar 2009 09:56:05 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/03/29/difference-between-distinct-and-group-by-distinct-vs-group-by/#comment-49388</guid>
		<description>&quot;select CurrentOperator, COUNT(*) CurrentOperator from EZBusDB.dbo.Buses
GROUP BY CurrentOperator&quot;


Delete   Comma(,)  At the End of Your Command</description>
		<content:encoded><![CDATA[<p>&#8220;select CurrentOperator, COUNT(*) CurrentOperator from EZBusDB.dbo.Buses<br />
GROUP BY CurrentOperator&#8221;</p>
<p>Delete   Comma(,)  At the End of Your Command</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Shwaria</title>
		<link>http://blog.sqlauthority.com/2007/03/29/sql-server-difference-between-distinct-and-group-by-distinct-vs-group-by/#comment-49367</link>
		<dc:creator>Shwaria</dc:creator>
		<pubDate>Wed, 18 Mar 2009 04:21:34 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/03/29/difference-between-distinct-and-group-by-distinct-vs-group-by/#comment-49367</guid>
		<description>Hi Pinal,

I have a situation, I want to count the amount of time a similar name occurs in a table.

E.g.

Table Buses,

Starmart
Starmart
Starmart
Starmart
Starmart
Damai
Damai
Damai
Damai
Damai
Damai
Damai
Damai
Senibudaya
Senibudaya
Senibudaya
Senibudaya
Senibudaya
Senibudaya
Senibudaya
Senibudaya

How do i actually type out a sql script to group and return the count for each name.

This is what i used so far
select CurrentOperator, COUNT(*) CurrentOperator from EZBusDB.dbo.Buses
GROUP BY CurrentOperator, 

I am getting this error: 
Msg 102, Level 15, State 1, Line 2
Incorrect syntax near &#039;,&#039;.

How i go about it?

Thank you!</description>
		<content:encoded><![CDATA[<p>Hi Pinal,</p>
<p>I have a situation, I want to count the amount of time a similar name occurs in a table.</p>
<p>E.g.</p>
<p>Table Buses,</p>
<p>Starmart<br />
Starmart<br />
Starmart<br />
Starmart<br />
Starmart<br />
Damai<br />
Damai<br />
Damai<br />
Damai<br />
Damai<br />
Damai<br />
Damai<br />
Damai<br />
Senibudaya<br />
Senibudaya<br />
Senibudaya<br />
Senibudaya<br />
Senibudaya<br />
Senibudaya<br />
Senibudaya<br />
Senibudaya</p>
<p>How do i actually type out a sql script to group and return the count for each name.</p>
<p>This is what i used so far<br />
select CurrentOperator, COUNT(*) CurrentOperator from EZBusDB.dbo.Buses<br />
GROUP BY CurrentOperator, </p>
<p>I am getting this error:<br />
Msg 102, Level 15, State 1, Line 2<br />
Incorrect syntax near &#8216;,&#8217;.</p>
<p>How i go about it?</p>
<p>Thank you!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SQLAuthority News - Best Articles on SQLAuthority.com Journey to SQL Authority with Pinal Dave</title>
		<link>http://blog.sqlauthority.com/2007/03/29/sql-server-difference-between-distinct-and-group-by-distinct-vs-group-by/#comment-47187</link>
		<dc:creator>SQLAuthority News - Best Articles on SQLAuthority.com Journey to SQL Authority with Pinal Dave</dc:creator>
		<pubDate>Tue, 24 Feb 2009 12:07:03 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/03/29/difference-between-distinct-and-group-by-distinct-vs-group-by/#comment-47187</guid>
		<description>[...] SQL SERVER - Difference between DISTINCT and GROUP BY - Distinct vs Group By [...]</description>
		<content:encoded><![CDATA[<p>[...] SQL SERVER &#8211; Difference between DISTINCT and GROUP BY &#8211; Distinct vs Group By [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: madhavi</title>
		<link>http://blog.sqlauthority.com/2007/03/29/sql-server-difference-between-distinct-and-group-by-distinct-vs-group-by/#comment-46478</link>
		<dc:creator>madhavi</dc:creator>
		<pubDate>Mon, 09 Feb 2009 12:14:10 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/03/29/difference-between-distinct-and-group-by-distinct-vs-group-by/#comment-46478</guid>
		<description>i like pinal dave blogs</description>
		<content:encoded><![CDATA[<p>i like pinal dave blogs</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sagar</title>
		<link>http://blog.sqlauthority.com/2007/03/29/sql-server-difference-between-distinct-and-group-by-distinct-vs-group-by/#comment-46068</link>
		<dc:creator>Sagar</dc:creator>
		<pubDate>Wed, 28 Jan 2009 13:53:55 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/03/29/difference-between-distinct-and-group-by-distinct-vs-group-by/#comment-46068</guid>
		<description>hi pinal,
           i&#039;m struck with an issue related to distinct clause.
i&#039;ve fired a query in which i&#039;ve used distict clause. As per that i&#039;m getting distinct rows but they are repeatative in nature.
e.g. if i&#039;m getting 3 distinct rows from my query; i&#039;m getting 1st row many hundreds of time, followed by 2nd and 3rd row in the same manner. How to suppress these repeated rows and how to only three distinct rows as a output?
Thanx in advance.</description>
		<content:encoded><![CDATA[<p>hi pinal,<br />
           i&#8217;m struck with an issue related to distinct clause.<br />
i&#8217;ve fired a query in which i&#8217;ve used distict clause. As per that i&#8217;m getting distinct rows but they are repeatative in nature.<br />
e.g. if i&#8217;m getting 3 distinct rows from my query; i&#8217;m getting 1st row many hundreds of time, followed by 2nd and 3rd row in the same manner. How to suppress these repeated rows and how to only three distinct rows as a output?<br />
Thanx in advance.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: FeelTheWay</title>
		<link>http://blog.sqlauthority.com/2007/03/29/sql-server-difference-between-distinct-and-group-by-distinct-vs-group-by/#comment-45005</link>
		<dc:creator>FeelTheWay</dc:creator>
		<pubDate>Mon, 22 Dec 2008 15:09:08 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/03/29/difference-between-distinct-and-group-by-distinct-vs-group-by/#comment-45005</guid>
		<description>When request is very simple, Distinct can be used else always use Group By. really faster.</description>
		<content:encoded><![CDATA[<p>When request is very simple, Distinct can be used else always use Group By. really faster.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve Hatchard</title>
		<link>http://blog.sqlauthority.com/2007/03/29/sql-server-difference-between-distinct-and-group-by-distinct-vs-group-by/#comment-44373</link>
		<dc:creator>Steve Hatchard</dc:creator>
		<pubDate>Mon, 24 Nov 2008 18:18:49 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/03/29/difference-between-distinct-and-group-by-distinct-vs-group-by/#comment-44373</guid>
		<description>Your best answer is to have two tables - one for unique employee data EmployeeId, EmployeeName, CurrentTitle etc.. and one for multiple row data - EmployeeId, ContractDate. It is usually best practice to &quot;normalise&quot; data like this.

This off topic and not really an issue for DISTINCT.

Steve Hatchard
Director
Mattched IT Ltd</description>
		<content:encoded><![CDATA[<p>Your best answer is to have two tables &#8211; one for unique employee data EmployeeId, EmployeeName, CurrentTitle etc.. and one for multiple row data &#8211; EmployeeId, ContractDate. It is usually best practice to &#8220;normalise&#8221; data like this.</p>
<p>This off topic and not really an issue for DISTINCT.</p>
<p>Steve Hatchard<br />
Director<br />
Mattched IT Ltd</p>
]]></content:encoded>
	</item>
</channel>
</rss>
