I haven't seen anyone respond to this one yet...So...
When you have a function like COUNT, you must include all other columns in
the group by. Adding the phID to the group by statement should fix it.
Like this:
SELECT phID, phCOL, COUNT(phID) As coPHOTOS FROM photos
WHERE phGROUP='#grid#' AND phCOL IS NOT NULL
GROUP BY phCOL, phID
-----Original Message-----
From: Michael Lugassy [mailto:[EMAIL PROTECTED]]
Sent: Thursday, May 03, 2001 6:11 AM
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/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists