SiteExperts.com Logo Home | Community | Developer's Paradise
User Groups | Site Tools | Site Information | Search
 Main Menu
 Forums
SiteExperts.com Forums
All Discussions

SiteExperts Feedback
The Lounge
Dynamic HTML
Site Design/ Critiques
HTML and CSS
XML Technologies
The Wireless Internet
Internet Explorer
Microsoft .NET
The Server
Technical Support

Sponsored Links

User Groups : Forums : SiteExperts : The Server :

Previous DiscussionNext Discussion
 MySQL query question...

Ok, here's the deal. I'm working on a home project, and I'm having a bit of a problem.I have a query that gets points for, points against, and points differential.This part of the query works fine, because these are calculated by my C#, and stored in the DB.The problem is, I'm trying to get a percentage for the points differential, using something akin to this:

SELECT T.TEAM_NAME, S.POINTS_FOR, S.POINTS_ALLOWED, S.POINTS_DIFFERENTIAL,(S.POINTS_DIFFERENTIAL / MAX(S.POINTS_DIFFERENTIAL)) AS PDFROM SCORES SINNER JOIN TEAMS TON S.TEAM_ID = T.IDGROUP BY T.TEAM_NAME;

The results look something like this:

Team NamePoints ScoredPoints AllowedPoints DifferencePD
Team A1014-41.0000
Team B2810181.0000
Team C352781.0000
Team D121021.0000
Team E140141.0000


The problem with this is the math in the last column is way wrong. It should not be 1.0000 in each column. The last column should have the following values:

-.2222, 1.0000, .4444, .1111, .7777

I know I'm missing something simple. But what? I'll probably kick myself when I find out what it is...INVALID ARGUMENT***