Beginner help with SELECT query

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I have a table which holds the results from game scores.
It has the following columns:

gameID : team1Score : team2Score

I'd like to produce output that calculates the following:

# Games played
# Wins
# Losses
# Ties
# Goals For
# Golas Against
Winning Percentage

I only know how to accomplish this using 7 seperate queries, but can I
get the same results with only one query?


Re: Beginner help with SELECT query

Your best bet would be to run 1 query that gets the totals of all of the
fields, and then do the calculating in whatever language you are using (php,
c++, etc), since the programming languages are much faster at doing
calculations that mysql is.

-Brandon Rohde

Quoted text here. Click to load it

Site Timeline