>From what I have used it with, you want to do the following:

<cfquery datasource="dsn" name="q_test">
SELECT lname, COUNT(*) AS tot_clients
FROM Client
ORDER BY lname
</cfquery>

<cfoutput>
    <cfoutput queryname="q_test" groupby="1name">
    <li>#1name</li>
    </cfoutput>
#othervars#
</cfoutput>

Groupby groups the output by the field that you specify. This is the way I
have used it, refrencing Forta's basic book.

Scott Berry
--
Computer Simplistics Support
"Simple Solutions for a Complex World"
http://www.c-s.net
661-296-4315


----- Original Message -----
From: "Duane Boudreau" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Saturday, April 29, 2000 7:54 PM
Subject: RE: SQL Error using 'Name' as field


> I'm not too familiar with the group by function but in order to use it you
> must be using an (Sum, Avg, Count etc) aggregate function (hopefully
someone
> who knows this a bit better can clarify this more)
>
> ex:
>
> <cfquery datasource="dsn" name="q_test">
> SELECT lname, COUNT(*) AS tot_clients
> FROM Client
> GROUP BY lname
> ORDER BY lname
> </cfquery>
>
>
> Duane Boudreau
> CFExperts.Com
>
>
> -----Original Message-----
> From: Pablo Nevares [mailto:[EMAIL PROTECTED]]
> Sent: Saturday, April 29, 2000 9:57 PM
> To: [EMAIL PROTECTED]
> Subject: SQL Error using 'Name' as field
>
>
> I'm performing the following query to an Access database in a page:
>
> <cfquery datasource="webtrack" name="pkg_recipients">
> SELECT Name, PackageSent
> FROM location
> WHERE NOT PackageSent IS NULL
> GROUP BY PackageSent;
> </cfquery>
>
> However, I get this error when executing it:
>
> -----
> Error Diagnostic Information
> ODBC Error Code = S1000 (General error)
>
> [Microsoft][ODBC Microsoft Access Driver] You tried to execute a query
that
> does not include the specified expression 'Name' as part of an aggregate
> function.
>
> Data Source = "webtrack"
>
> The error occurred while processing an element with a general identifier
of
> (CFQUERY), occupying document position (10:1) to (10:53) in the template
> file D:\web\package_summary.cfm.
> -----
>
> I've searched in both the Same SQL reference book and the MS Access help
> files, and neither say that "Name" is a reserved word ("Names" does show
up
> in the Sams book).
>
> Thanks in advance.
>
> Pablo Nevares
> Information Technology
> Hendricks & Partners
> [EMAIL PROTECTED]
>
> --------------------------------------------------------------------------
--
> --
> Archives: http://www.eGroups.com/list/cf-talk
> To Unsubscribe visit
> http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
> send a message to [EMAIL PROTECTED] with 'unsubscribe' in
> the body.
>
> --------------------------------------------------------------------------
----
> Archives: http://www.eGroups.com/list/cf-talk
> To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.
>



------------------------------------------------------------------------------
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to