Help with Mysql query

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Sundin

    Help with Mysql query

    Hi I'm running a sports pool and I'm trying to display stats from the
    results of the picks.

    The table is 'results' and the fields are 'pick_number', 'game_number',
    'user_id', 'points' and 'date'

    There is one record for each users' pick. 0 points are given for a loss
    and 1-4 points are given for a win. I've already created a query that
    gives me the top players by overall points but I'd like to expand that
    to include the number of points won just this week, overall winning %
    and winning % this week. Can I do this in one query and then display in
    an HTML table?

    This is what I have so far. Any help is appreciated.

    $query = "SELECT user_id, SUM(points) AS points FROM results GROUP BY
    user_id ORDER BY points DESC";

Working...