> Here's a conundrum I'm having with MySQL.
> 
> The following code returns a bunch of records:
> 
> SELECT sl_Year,
>        sl_DayOfYear,
>        sl_Query,
>        SUM(sl_CountOfOccurrences) AS NumRequests
> FROM SearchLog
> GROUP BY sl_Year,
>          sl_DayOfYear,
>          sl_Query
> 
> one of these records looks like (there are more, but this serves as an
> example):
> 
> 2001      305       'vru'       8
> 
> If I then use the following SQL:
> 
> SELECT sl_Year,
>        sl_DayOfYear,
>        sl_Query,
>        SUM(sl_CountOfOccurrences) AS NumRequests
> FROM SearchLog
> GROUP BY sl_Year,
>          sl_DayOfYear,
>          sl_Query
> HAVING NumRequests > 3
> 
> I get ZERO records returned.  As an alternate, I also tried:
> 
> SELECT sl_Year,
>        sl_DayOfYear,
>        sl_Query,
>        SUM(sl_CountOfOccurrences) AS NumRequests
> FROM SearchLog
> GROUP BY sl_Year,
>          sl_DayOfYear,
>          sl_Query
> HAVING SUM(sl_CountOfOccurrences) > 3
> 
> and that also returned ZERO records.
> 
> Has anyone else encountered this problem?

You do not tell us which MySQL version you're using. Some
of the early 3.23 versions had some problems with the
SUM()/other group functions. They should have been
resolved with v. 3.23.09.

/ Carsten
--
Carsten H. Pedersen
keeper and maintainer of the bitbybit.dk MySQL FAQ
http://www.bitbybit.dk/mysqlfaq


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to