At 1:56 PM -0500 09-11-2000, Mark Brummett \(Hoss\) wrote:
>I've enjoyed thoroughly reading all the informative posts included on this
>mailing list. Now I have a question and hopefully someone can point me in
>the right direction.
>We have three tables, and what we are trying to accomplish is to have a
>running standings page for minor league hockey formatted into a table. Now,
>with PHP we know how to do this, the problem now is that the query is
>returning errors and we can't track it down. Here are all the tables.
>Now, here is the query...
>SELECT teams.Division, teams.TeamCity, Sum(tempsked.TeamScore) AS GoalsFor,
>Sum(tempsked.OppScore) AS GoalsAgainst, [Win]+[Loss]+[SOL] AS GP, [GP]*2 AS
>PA, Sum(tempsked.Win) AS Win, Sum(tempsked.Loss) AS Loss, Sum(tempsked.SOL)
>AS SOL, Sum(tempsked.Points) AS Points, [Points]/[PA] AS Per,
>Sum(tempsked.HomeWin) AS HomeWin, Sum(tempsked.HomeLoss) AS HomeLoss,
>Sum(tempsked.HomeSOL) AS HomeSOL, Sum(tempsked.RoadWin) AS RoadWin,
>Sum(tempsked.RoadLoss) AS RoadLoss, Sum(tempsked.RoadSOL) AS RoadSOL,
>Sum(tempsked.DivWin) AS DivWin, Sum(tempsked.DivLoss) AS DivLoss,
>Sum(tempsked.DivSOL) AS DivSOL FROM teams INNER JOIN tempsked ON
>teams.TeamID = tempsked.Team GROUP BY teams.Division, teams.TeamCity ORDER
>BY teams.Division, Sum(tempsked.Points) DESC
>Now, I know this has been a little longwinded, but I'm at my wit's end. Are
>the bracketed expressions causing the problem? If they are, I've removed
>those, and still have not had any luck. If anyone could help, it would sure
Question for you: are you under the impression that square brackets
are legal syntax in this query? Or are you only showing those to
indicate the parts of your query that seem to be giving you problems?
Note also that giving a column another name using an alias
(col_name AS alias_name) doesn't mean you can refer to that alias
elsewhere in the column selection list. For example, try substituting
Sum(tempsked.Win) wherever you're referring to the Win alias.
Paul DuBois, paul@stripped