Just as a little more detail, since you were grouping your query by one column, the db 
didn't know what to do with the other columns, so like the others said, adding the 
other columns to the 'group by' fixes your error.
But in other cases, you may need to use aggregate functions on fields that you don't 
want grouped, ie MIN, MAX, AVG, COUNT...etc, varies on what db you use

hth,
seth

-----Original Message-----
From: Bryan F. Hogan [mailto:[EMAIL PROTECTED]
Sent: Monday, August 04, 2003 9:45 AM
To: CF-Talk
Subject: RE: What the heck is wrong with this Query?


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

will work.

I think that all of the columns in a select distinct need to be in the
groupby also if I remember correctly.

-----Original Message-----
From: Les Mizzell [mailto:[EMAIL PROTECTED]
Sent: Monday, August 04, 2003 9:38 AM
To: CF-Talk
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

Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. 
http://www.fusionauthority.com/signup.cfm

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

Reply via email to