List:Melbourne MySQL Users Group« Previous MessageNext Message »
From:bharanee rathna Date:October 2 2008 12:16am
Subject:discrepancy in numbers from SELECT COUNT(DISTINCT ...) and SELECT DISTINCT
View as plain text  
Hi,

I have a peculiar issue where

SELECT DISTINCT Email, Suburb, State FROM Users  WHERE ( Email = '
test@stripped' );

gives me
*14565* rows in set (0.20 sec)

but the same query written as

SELECT COUNT(DISTINCT Email, Suburb, State) FROM Users  WHERE ( Email = '
test@stripped' );

gives me
+------------------------------------------------+
| count(DISTINCT Email, Suburb, State)           |
+------------------------------------------------+
|                                          *12616* |
+------------------------------------------------+
1 row in set (0.12 sec)

Not sure if I'm missing something obvious here, I'd appreciate if someone
can shed light on this strange behavior.

I'm using Server version: 5.0.22-Debian_3

Thanks
Bharanee

Thread
discrepancy in numbers from SELECT COUNT(DISTINCT ...) and SELECT DISTINCTbharanee rathna2 Oct
  • Re: discrepancy in numbers from SELECT COUNT(DISTINCT ...) and SELECT DISTINCTdeepfryed2 Oct