Jump to content

lunarbytes

Members
  • Content Count

    2
  • Joined

  • Last visited

Community Reputation

0 Neutral

About lunarbytes

  • Rank
    Newbie
  1. Thanks. I found the answer using a different query and it now does what it supposed to do.
  2. I am trying to sum a column from a qurey using the top values only. Using the following line I get the result ( 7 top distance answer) for that column. $distance = mysql_query("SELECT distance FROM competition WHERE JPersonID=$row[iD] ORDER BY distance DESC LIMIT 7"); $row[iD] is from an earlier query so that only values related to the above query is called. As can be seen I order the result from highest to lowest limiting the result to 7 records. Now I need to add these results, to get a total distance. Using the 'SUM(distance) As xxx' does not give me the right result in the above query. (It counts all the distances relating to $row[iD]. I only require the top 7 results. Please can someone help? The result displayed should be as follows: (The code for this is not required. I just need to know how to sum the 7 jumps using the query) Total Distance Jump 1 Jump 2 Jump3 Jump4 Jump5 Jump6 Jump7 32.4 5.4 5.3 5.1 4.8 4.5 3.9 3.4
×
×
  • Create New...