Use a HAVING clause before your ORDER BY clause, e.g. "having
count(contestantID) >= 2"
-----Original Message-----
From: Jay Patton [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 26, 2001 11:11 AM
To: CF-Talk
Subject: Statement Question/Help
Good day all,
I was wondering if anyone could help me with this. i have a statement shown
below that works great. however i was wondering if someone might give me an
idea of how to do this: i need to display ONLY the contestants that show up
in the ResultsManager (this is a table) More than once. the following query
displays everyone (with the proper gender that is) but im haveing problems
getting it to show just the contestants that have 2 or more events recorded
in the ResultsManager. should i edit this query or should i do another one
and 'tie' them to gether? im kinda at a loss here, not sure what to do. any
help would be greatly appreciatted. here is my statement....
<cfquery name="GetTotalPts"
datasource="#datasource#"
dbtype="ODBC"
username="#username#"
password="#password#">
SELECT ResultsManager.ContestantID, ContestantManager.FirstName,
ContestantManager.LastName, ContestantManager.City, ContestantManager.State,
SUM (ResultsManager.AdjPoints) as TOTALPTS
FROM ResultsManager INNER JOIN ContestantManager ON
ResultsManager.ContestantID = ContestantManager.ContestantID
WHERE ContestantManager.Gender = '2' AND ResultsManager.NotAllAround = '0'
GROUP BY ResultsManager.ContestantID, ContestantManager.FirstName,
ContestantManager.LastName, ContestantManager.City, ContestantManager.State
ORDER BY SUM (AdjPoints) DESC
</cfquery>
Thanks a TON!,
Jay Patton
Web Design / Application Design
Web Pro USA
p. 406.549.3337 ext. 203
p. 1.888.5WEBPRO ext. 203
e. [EMAIL PROTECTED]
url. www.webpro-usa.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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