cedsn
12-17-2003, 09:54 PM
I have 4 colums in my table.. they are id(int), usrid (int), datestamp (date) and credits(float).
here's what i'd like to do.. select the numeric rank of a given userid over the past 30 days based on the most credits... ideally i'd like it all to be in one query but that may not be possible.. any ideas are welcome here, i'm stumped on this one.. so far all i've been able to do is select all the entries from the last 30 days..
SELECT *
FROM daycredit
WHERE TO_DAYS( NOW( ) ) - TO_DAYS( datestamp ) <= 30
and usrid = $usrid LIMIT 0, 30
here's what i'd like to do.. select the numeric rank of a given userid over the past 30 days based on the most credits... ideally i'd like it all to be in one query but that may not be possible.. any ideas are welcome here, i'm stumped on this one.. so far all i've been able to do is select all the entries from the last 30 days..
SELECT *
FROM daycredit
WHERE TO_DAYS( NOW( ) ) - TO_DAYS( datestamp ) <= 30
and usrid = $usrid LIMIT 0, 30