MyBB Community Forums

Full Version: PHPMyAdmin Referral Query
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
http://community.mybb.com/thread-137880.html

I am looking at doing this post (http://community.mybb.com/thread-137880-...#pid995181) but for referrals. What would I need to enter instead?

Thank you.
Anyone know this?
please elaborate your requirement so that someone can provide guidance
(2013-07-13, 02:35 PM).m. Wrote: [ -> ]please elaborate your requirement so that someone can provide guidance

Okay.

As an example, I am hosting a 48 hour posting contest. In PHPMyAdmin to check who got the most posts I would run this query

Quote:SELECT u.uid, u.username, s.total
FROM mybb_users u
INNER JOIN (
SELECT uid, count( * ) AS total
FROM mybb_posts
WHERE dateline >= ( UNIX_TIMESTAMP( NOW( ) ) - ( 24 *60 *60 ) )
GROUP BY uid
)s ON u.uid = s.uid
ORDER BY s.total DESC

What would I need to enter to check for most referrals? I want to check who has the most referrals within the 2 week time limit.
I know the query to find the most referrers in PHPMyAdmin which is

SELECT * FROM `mybb_users` ORDER BY `referrals` DESC 

The very first table would be the top referrer but I wouldn't know for under a certain period of time.
Hmm, yeah. I am holding a 2 week referral contest so I am trying to find out who has the most in the set 2 week time frame.
Still wondering about this.