Should have been:

SELECT modelname, modeldescription, makename, year
FROM MODELS
WHERE rating = 'Very Compatible'
GROUP BY makename, modeldescription, modelname, year

-----Original Message-----
From: Darryl Lyons [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 10, 2001 9:18 AM
To: CF-Talk
Subject: RE: GROUP BY gives an error?


you need to include all of the columns in the SELECT in the GROUP BY also.

e.g.

SELECT modelname, modeldescription, makename, year
FROM MODELS
WHERE rating = 'Very Compatible'
GROUP BY makename, modeldescription, modelname, year

-----Original Message-----
From: Jeff Fongemie [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 10, 2001 9:31 AM
To: CF-Talk
Subject: GROUP BY gives an error?


Hello cf-Talk,

  I have a simple query.

<cfquery name="best" datasource="#Application.dsn#">
SELECT modelname, modeldescription, makename, year
FROM MODELS
WHERE rating = 'Very Compatible'
GROUP BY makename 
</cfquery>  

It keeps giving me this error:ODBC Error Code = 37000 (Syntax error or
access violation)

[Microsoft][ODBC Microsoft Access Driver] You tried to execute a query
that does not include the specified expression 'modelname' as part of
an aggregate function.

 What the heck am I missing here?

The "makename" field is a lookup field in an Access database, would
this have anything to do with it? So far the lookup has worked fine in
queries.



Best regards,
 Jeff Fongemie                          mailto:[EMAIL PROTECTED]
------------------------ 
Internet Guns For Hire
(603) 356-0768
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to