[thelist] help with SQL query

Michael Robertson mike at mikeemedia.com
Wed Jul 31 15:49:00 CDT 2002


Thanks

I need the average steps per week not a total average for one user,

so user 777 has been at it for say 6 weeks, I need the average # of steps he
takes in a one week period. The statement below returns each weeks average.
I can use it as a subquery to get the one average from those weeks?

SELECT avg(steps) FROM tblRecordSteps where UserID='777' GROUP BY
ProgramWeek

> >
> >Can i get an overall average from this - I tried using this as a subquery
> >and got an error
>
> SELECT AVG(steps)
> FROM tblRecordSteps
> WHERE UserID=777;
>
> This will return the average of steps for every record that
> has a UserID equal to 777. Therefore, it is irrelevant how
> long they've been in the program or what stage they're in.
> This will be their total average. Is this what you're
> looking for?
>
> =D
> --
> For unsubscribe and other options, including
> the Tip Harvester and archive of thelist go to:
> http://lists.evolt.org Workers of the Web, evolt !
>




More information about the thelist mailing list