you need to add the other columns in the group by clause...

<cfquery name="PA_CT" datasource="phoenixart">
SELECT
    DISTINCT PA_COUNTRY,
    ID,
    PA_CATEGORY
FROM
    papers
GROUP BY
    PA_CATEGORY,
    ID,
    PA_COUNTRY
</cfquery>

That should work...

Mike





----- Original Message ----- 
From: "Les Mizzell" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Monday, August 04, 2003 9:38 AM
Subject: What the heck is wrong with this Query?


> Given a small Access database containing:
>
> ID, PA_COUNTRY, PA_CATEGORY
>
>
> <cfquery name="PA_CT" datasource="phoenixart">
> SELECT DISTINCT PA_COUNTRY, ID, PA_CATEGORY
>   FROM papers
>   GROUP BY PA_CATEGORY
> </cfquery>
>
>
> I get the following error:
> You tried to execute a query that does not include the specified
expression
> 'PA_COUNTRY' as part of an aggregate function.
>
> If I remove the "GROUP BY" - it works....but I need that in there!
>
>
>
> 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq

This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.
http://www.cfhosting.com

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
                                

Reply via email to