ga_white
10-01-2008, 06:12 PM
Hi everyone,
I'm trying to pull a top ten list from an Access Database with the following columns ...
ID (primary key)
UserID (user)
TeamName (group)
When (date)
Weight (number in lbs.)
Here is the thing ... I'm trying to pull the top ten Teams based on the percent of weight they have lost.
(Total Team Weight / Total Initial Team Weight)*100
Can I do this with one SQL statement? I guess I'm not sure how to sort the initial weights from subsequent weights.
I've been working on something like this but I'm obviously missing something.
strSQL = "SELECT top 10 Team, ((SUM(recent)/SUM(original))*100) as Total FROM tblWeights GROUP BY Team ORDER BY Total desc"
Any thoughts or ideas? Maybe there is a better way altogether?
Many thanks,
I'm trying to pull a top ten list from an Access Database with the following columns ...
ID (primary key)
UserID (user)
TeamName (group)
When (date)
Weight (number in lbs.)
Here is the thing ... I'm trying to pull the top ten Teams based on the percent of weight they have lost.
(Total Team Weight / Total Initial Team Weight)*100
Can I do this with one SQL statement? I guess I'm not sure how to sort the initial weights from subsequent weights.
I've been working on something like this but I'm obviously missing something.
strSQL = "SELECT top 10 Team, ((SUM(recent)/SUM(original))*100) as Total FROM tblWeights GROUP BY Team ORDER BY Total desc"
Any thoughts or ideas? Maybe there is a better way altogether?
Many thanks,