SELECT Statement Blues

by "Valerie L. Criswell" <valerie(at)suresource.net>

 Date:  Thu, 30 Nov 2000 11:18:26 -0500
 To:  <hwg-techniques(at)hwg.org>
  todo: View Thread, Original
I have a high school sports site that tracks schedules, scores, and whatnot.
I have managed to write a query that calculates the number of wins and
losses from columns of scores.  What I don't seem to be successful at doing
is ranking the schools within their subdivisions according to the number of
wins.  It seems that because the win column is a calculated one generated on
the fly, when I try to ORDER BY it, I get an error.  Does anyone know how to
overcome this problem?  The site is written in Cold Fusion and the database
is Access2000.  Below is the SELECT statement ordering by highschool only.
Below, I have also included the CF error that I receive when I ORDER BY
GamesWon.  To help get an idea of what this is all about, the live page may
be viewed at http://www.schighschoolsports.com/sports/mbball/index.cfm .
TIA to all! ~Val

SELECT
Highschool.Category, Highschool.Region, Highschool.Highschool,
Highschool.Code,
(select count (*) from GameScore where (HomeTeam = Highschool.Highschool AND
HomeTeamScore > AwayTeamScore) OR (AwayTeam = Highschool.Highschool AND
AwayTeamScore > HomeTeamScore)) as GamesWon,
(select count (*) from GameScore where (HomeTeam = Highschool.Highschool AND
HomeTeamScore < AwayTeamScore) OR (AwayTeam = Highschool.Highschool AND
AwayTeamScore < HomeTeamScore)) as GamesLost
FROM Highschool
WHERE Highschool.Category = 'AAAA' AND Play = yes ORDER BY
Highschool.Highschool

Error Diagnostic Information
ODBC Error Code = 07001 (Wrong number of parameters)


[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.

Hint: The cause of this error is usually that your query contains a
reference to a field which does not exist. You should verify that the fields
included in your query exist and that you have specified their names
correctly.


The error occurred while processing an element with a general identifier of
(CFQUERY), occupying document position (2:1) to (2:62).


Date/Time: 11/30/00 11:14:18
Browser: Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0)
Remote Address: 63.100.167.6
HTTP Referer: http://www.schighschoolsports.com/sports/mbball/index.cfm
Template: z:\www\schighschoolsports.com\sports\wbball\index.cfm

HWG hwg-techniques mailing list archives, maintained by Webmasters @ IWA