Selecting Weekly Averages from MySQL table
Posted: Sun Dec 21, 2003 11:11 am
Hi Guys,
I need some help for a piece of PHP code.
I have a MySQL table (let's call it myweight) where I have the following columns: userid, signupdate, weight, currentdate.
What I need is a code that would calculate the weekly average weight of each user based on the signup date. I know I how to calculate the average weight for a user using the AVG() function in MySQL, but I'm stuck with finding a way to select, for each week since somebody has been a member, only the weight values from that week.
Thanks a lot for your help.
Klaus.
I need some help for a piece of PHP code.
I have a MySQL table (let's call it myweight) where I have the following columns: userid, signupdate, weight, currentdate.
What I need is a code that would calculate the weekly average weight of each user based on the signup date. I know I how to calculate the average weight for a user using the AVG() function in MySQL, but I'm stuck with finding a way to select, for each week since somebody has been a member, only the weight values from that week.
Thanks a lot for your help.
Klaus.