Jump to content

League Database and Query


Mr Rich UK

Recommended Posts

Hi there,

 

I run a site where people play sports games against each other.

 

Now I've been looking to create a system which updates standings automatically and I think I am getting close, but I just needed a little help to get over a few problems.

 

I'm guessing it's sensible to separate the data into two tables, first one probably containing the following, let's call it 'madden_teams'

 

team_id, team_name

 

then have a table for the results, which we'll call 'madden_results'

 

result_id, away_team, away_score, home_team, home_score, week

 

I know this has something to do with joins, and I have looked into it, but I am confused by how you can use the recognition over how one result is larger than the other to get the standings.

 

So onto the query I need to do.

 

Obviously I'm going to have to do something like:

 

SELECT team_name, Sum(W), Sum(L), Sum (D)

 

To get my wins and losses, but how would I go about trying to build the rest of the query to show wins and losses correctly for each team?

 

I feel like I'm stepping up a level here and I don't really understand how you can do this.

 

Link to comment
https://forums.phpfreaks.com/topic/164932-league-database-and-query/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.