View Single Post

   
  #5 (permalink)  
Old 03-01-2008, 03:49 PM
Pavel Lepin
 
Posts: n/a
Default Re: SELECT, GROUP BY & HAVING problem!


stockton <simon.stockton@baesystems.com> wrote in
<cbc1feba-429e-435f-a589-4654ffc0771b@u69g2000hse.googlegroups.com>:
>> SELECT ID_2, DAY, COUNT(*) AS COUNT, DISTINCT(MONTH) FROM
>> `TABLE` GROUP BY `ID_2`, `DAY` HAVING COUNT > 1

>
> Unfortunately this doesn't work!


Jerry was probably just a bit low on caffeine or something:

SELECT ID_2, DAY, COUNT(DISTINCT MONTH) AS COUNT FROM
`TABLE` GROUP BY `ID_2`, `DAY` HAVING COUNT > 1;

But really, you should've been able to figure that out
yourself. That's what the docs are for.

--
In Soviet Russia, XML documents transform *you*.
Reply With Quote