MYSQL joining and sumation!?? Help Needed!

Discussion in 'MySQL' started by Zhoog, Feb 26, 2009.

  1. #1
    I have the following problem:

    I have a table with usernames and ids:

    tbl_members:
    MID NAME
    1 john
    2 peter
    3 richard

    And a table with points scored by these users on particular dates, like this:

    tbl_scores:
    ID MID POINTS DAY MONTH YEAR
    1 1 2 02 07 2007
    2 2 6 02 07 2007
    3 3 3 02 07 2007
    4 1 3 01 03 2008
    5 2 6 01 03 2008
    6 3 8 01 03 2008
    7 1 9 15 11 2008
    8 2 3 15 11 2008
    9 3 6 15 11 2008



    Now I want to output a score board Listing the members names vertically and then their points for each date and their total points scored over a specific time, like this:

    NAME 02-07-2007 01-03-2008 15-11-2008 TOTAL
    richard 3 8 6 17
    peter 6 6 3 15
    john 2 3 9 14

    The score chart should be sorted on the total points.

    Can you help me with the MYSQL query? Can i use only one with difficult JOIN and SUM commands in them? I've been playing around with that, but I'm very much stuck here!

    Thanks for your help!
     
    Zhoog, Feb 26, 2009 IP
  2. Zhoog

    Zhoog Peon

    Messages:
    237
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Any ideas on this?? Should I explain it differently?

    help is very much appreciated!!
     
    Zhoog, Mar 3, 2009 IP