You cant mix summary functions with normal selects in SQL
To do what you want in CF, you're probalby best using queryname.recordcount
in CF.
<cfquery name="queryname" ........>
SELECT phID, phCOL FROM photos
WHERE phGROUP='#grid#' AND phCOL IS NOT NULL
GROUP BY phCOL
</cfquery>
<cfset cophotos = queryname.recordcount>
HTH
Dan
-----Original Message-----
From: Michael Lugassy [mailto:[EMAIL PROTECTED]]
Sent: 03 May 2001 11:11
To: CF-Talk
Subject: Simple SQL SELECT
I'm trying to simply select a few colums from a table (phID,phCOL)
+ the count of that certain select each time into a variable (coPHOTOS)
SELECT phID, phCOL, COUNT(phID) As coPHOTOS FROM photos
WHERE phGROUP='#grid#' AND phCOL IS NOT NULL
GROUP BY phCOL
I keep on getting an error: Column 'photos.phID' is invalid in the select
list because it is not contained in either an aggregate function or the
GROUP
BY clause.
What is wrong? Thanks!
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists