Re: Difference in number of row observstions from distinct and group by

2013-11-25 Thread David Morel
On 25 Nov 2013, at 9:06, Mayank Bansal wrote: Hi, I was also thinking that this might be the case. For that reason I ran this query Select * from (select col1,col2,col3,count(*) as val from table_name group by col1,col2,col3)a where a.val>1 ; The output that I receive from this query is bl

RE: Difference in number of row observstions from distinct and group by

2013-11-25 Thread Mayank Bansal
got the same number of rows as originally in the table. Please help me figure this out. Thanks, Mayank -Original Message- From: Thejas Nair [mailto:the...@hortonworks.com] Sent: Friday, November 22, 2013 1:49 AM To: Subject: Re: Difference in number of row observstions from distinct

Difference in number of row observstions from distinct and group by

2013-11-21 Thread Mayank Bansal
Hi, I have a table which has 3 columns combined together to form a primary key. If I do Select count(distinct col1,col2,col3) from table_name; And Select count(a.*) from (select col1,col2,col3,count(*) from table_name group by col1,col2,col3)a ; While running the first query, the count of ro

Re: Difference in number of row observstions from distinct and group by

2013-11-21 Thread Thejas Nair
You probably have 400 rows where col1, col2 and col3 have null values. "count(distinct col1,col2,col3) " will not count those rows. On Thu, Nov 21, 2013 at 7:13 AM, Mayank Bansal wrote: > Hi, > > > > I have a table which has 3 columns combined together to form a primary key. > If I do > > > > Se