Jump to content

Master

New Members
  • Posts

    2
  • Joined

  • Last visited

    Never

Posts posted by Master

  1. SELECT day, month, year,

    winning_country.country_name winning_country,

    losing_country.country_name losing_country,

    matches.winning_score, matches.losing_score, location, crowd, worldcup, (matches.winning_score + matches.losing_score) as totalpoints

    FROM matches,

    countries winning_country,

    countries losing_country

    WHERE (matches.winning_country = winning_country.country_id)

    AND (matches.losing_country = losing_country.country_id)

    AND (totalpoints>50)

     

    When I run this query, I get an error saying column totalpoints does not exist. Why is that?

  2. I have a table with three records - player_id, year, and points.

     

    Is there a way to compute a total points from point values stored in different records, in the initial query. Or do I need to execute a different query for every player, or add a total record for each player (call year 0000), and update both each time?

     

    Example records.

     

    player_id year points

     

    1 2000 424

    1 2001 313

    2 2001 131

    1 2002 242

    2 2002 431

     

    I want to return the total points for every player on the database. The number of years involved is a lot, so having all the years in the one record isn\'t really possible.

     

    thanks

×
×
  • 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.