RE: What the heck is wrong with this Query?

2003-08-09 Thread Michael Traher
Hi Les, You could use ListValueCountNoCase if there is some reason for not letting the dbms do this aggregation for you. On the whole the database engine is better (i.e. faster) at this kind of data manipulation than CF is. What I would suggest is that your select gets the country and count of

What the heck is wrong with this Query?

2003-08-04 Thread Les Mizzell
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

Re: What the heck is wrong with this Query?

2003-08-04 Thread Michael T. Tangorre
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 -

RE: What the heck is wrong with this Query?

2003-08-04 Thread Bryan F. Hogan
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-

RE: What the heck is wrong with this Query?

2003-08-04 Thread Turetsky, Seth
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

RE: What the heck is wrong with this Query?

2003-08-04 Thread Les Mizzell
The query itself doesn't error out like this, but I'm not getting the needed results to count categories like I need: cfquery name=PA_CT datasource=phoenixart SELECT DISTINCT PA_COUNTRY, ID, PA_CATEGORY FROM papers GROUP BY PA_COUNTRY, ID, PA_CATEGORY /cfquery CFSET egypt_Count =

RE: What the heck is wrong with this Query?

2003-08-04 Thread Jack Poe
De-dupe the list then count it :) -Jack -Original Message- From: Les Mizzell [mailto:[EMAIL PROTECTED] Sent: Monday, August 04, 2003 10:33 AM To: CF-Talk Subject: RE: What the heck is wrong with this Query? The query itself doesn't error out like this, but I'm not getting the

RE: What the heck is wrong with this Query?

2003-08-04 Thread Michael Traher
Maybe you need to exclude ID, something like cfquery name=PA_CT datasource=phoenixart SELECT PA_COUNTRY, count(distinct PA_CATEGORY) as category_count FROM papers GROUP BY PA_COUNTRY /cfquery This will count the distinct categories, grouped by country. If you still have problems, please post a

RE: What the heck is wrong with this Query?

2003-08-04 Thread Les Mizzell
::: CFSET egypt_Count = ListValueCountNoCase(ValueList(PA_CT.PA_COUNTRY),egypt) :: De-dupe the list then count it How you you do that, exactly? I need to be able to use #InsertNameOfCountryHere_Count# anywhere on the page as needed - for each of some 30 different countries