A better question is what the heck are you trying to do. If you use a group
by clause in sql you either need to include each field you're selecting in
the group by clause or do some sort of aggregate function to them. If you
trying to group the query by makename, then just order by makename in the
sql code and use <cfoutput query="" group=makename> to group it in your
output.
Rick
-----Original Message-----
From: Jeff Fongemie [mailto:[EMAIL PROTECTED]]
Sent: Monday, July 09, 2001 6:31 PM
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