Subject Re: [firebird-support] Need help with unexpected results from a query
Author Alexandre Benson Smith
At 16:27 11/03/2004 -0800, you wrote:

>Hi All,
>
>I have a query that has me stomped, to be exact it's the HAVING clause :-)
>
>Here is the query:
>
>SELECT
> ZIPCODE_ANALYSIS.ACTIVITY_NAME AS ActivityName,
> ZIPCODE_ANALYSIS.ZIP AS CustomerZip,
> COUNT(ZIPCODE_ANALYSIS.C_ID) AS CountCID
>FROM ZIPCODE_ANALYSIS
>GROUP BY
> ZIPCODE_ANALYSIS.ACTIVITY_NAME,
> ZIPCODE_ANALYSIS.ZIP
>HAVING
> (ZIPCODE_ANALYSIS.ACTIVITY_DATE BETWEEN '02/01/2004' AND '02/29/2004')
>ORDER BY 1


Hi Raf,

Did you tried to put the restriction clause in a where statement instead of
in the having clause ?

like this:


SELECT
ZIPCODE_ANALYSIS.ACTIVITY_NAME AS ActivityName,
ZIPCODE_ANALYSIS.ZIP AS CustomerZip,
COUNT(ZIPCODE_ANALYSIS.C_ID) AS CountCID
FROM ZIPCODE_ANALYSIS
GROUP BY
ZIPCODE_ANALYSIS.ACTIVITY_NAME,
ZIPCODE_ANALYSIS.ZIP
where
(ZIPCODE_ANALYSIS.ACTIVITY_DATE BETWEEN '02/01/2004' AND '02/29/2004')
ORDER BY 1



>TIA
>
>raf

See you !


Alexandre Benson Smith
Development
THOR Software e Comercial Ltda.
Santo Andre - Sao Paulo - Brazil
www.thorsoftware.com.br

----------


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.596 / Virus Database: 379 - Release Date: 26/02/2004


[Non-text portions of this message have been removed]