could you possibly intersect the differing results to see what the extra rows are?
+2
A:
John Boker
2008-10-28 18:03:55
Does mysql support MINUS?
2008-10-28 18:26:04
One of the differing results is an aggregate, how could he do this?
Dave Costa
2008-10-28 19:27:39
A:
In the first case, what happens if you change it to "select distinct(email) from newsletter order by email;
" I don't think it should make a difference, but it might.
Paul Tomblin
2008-10-28 18:13:12
+2
A:
My guess is that there are some null values in email column. Try
select count(*) from newsletter where email is null;
Maglob
2008-10-28 19:06:11
A:
Yes, as Maglob said you may be getting some NULLs in your email column. Try with something like:
SELECT COUNT(COALESCE(email, 0)) FROM newsletter
That would give you the results you expect. Oh, wait. The definition says that email does not accept NULL values. If that is truly the case, then it is odd.
Leandro López
2008-10-28 19:11:13
A:
One possible explanation is that rows were deleted from the table between your two queries. But I assume you've run these multiple times in various orders so I doubt that's it.
What rowcount do you get from this query:
SELECT email FROM newsletter GROUP BY email;
Dave Costa
2008-10-28 19:16:24