Zepo. Posted August 15, 2007 Share Posted August 15, 2007 I wanna get the top 10 refferers. So each user has a field saying the userid that referred them, what code would count up how many times a refferal id came up and list the top 10?? ??? Please help. Quote Link to comment https://forums.phpfreaks.com/topic/65152-solved-database-question/ Share on other sites More sharing options...
MadTechie Posted August 15, 2007 Share Posted August 15, 2007 Need more info about your database fields etc personally i would have a 'refferers' table with 3 field UID, UserID, RefsID then count(RefsID) group by RefsID Quote Link to comment https://forums.phpfreaks.com/topic/65152-solved-database-question/#findComment-325258 Share on other sites More sharing options...
Zepo. Posted August 16, 2007 Author Share Posted August 16, 2007 No theres a users table with one of the fields referer. Quote Link to comment https://forums.phpfreaks.com/topic/65152-solved-database-question/#findComment-325268 Share on other sites More sharing options...
MadTechie Posted August 16, 2007 Share Posted August 16, 2007 can you sort by that field then! Quote Link to comment https://forums.phpfreaks.com/topic/65152-solved-database-question/#findComment-325275 Share on other sites More sharing options...
Zepo. Posted August 16, 2007 Author Share Posted August 16, 2007 I dont think you get my question, i need to count how many times each id comes up then list the top 10. Quote Link to comment https://forums.phpfreaks.com/topic/65152-solved-database-question/#findComment-325277 Share on other sites More sharing options...
MadTechie Posted August 16, 2007 Share Posted August 16, 2007 ok please explain what you mean by No theres a users table with one of the fields referer. Quote Link to comment https://forums.phpfreaks.com/topic/65152-solved-database-question/#findComment-325280 Share on other sites More sharing options...
Zepo. Posted August 16, 2007 Author Share Posted August 16, 2007 Yes theres a User table with one of the fields refid. I need to count how many times each refid comes up in the user field the display the top 10 refferers. Quote Link to comment https://forums.phpfreaks.com/topic/65152-solved-database-question/#findComment-325281 Share on other sites More sharing options...
Zepo. Posted August 16, 2007 Author Share Posted August 16, 2007 Sooo noone knows? Quote Link to comment https://forums.phpfreaks.com/topic/65152-solved-database-question/#findComment-325291 Share on other sites More sharing options...
MadTechie Posted August 16, 2007 Share Posted August 16, 2007 please don't bump your own post unless an hour has passed also you havn't given the info we need.. oh who care total guess try SELECT count(refid), username FROM table1 Quote Link to comment https://forums.phpfreaks.com/topic/65152-solved-database-question/#findComment-325297 Share on other sites More sharing options...
Zepo. Posted August 16, 2007 Author Share Posted August 16, 2007 Well sorry i sorta need this fast. Doesnt that just select the count the number of times that it comes up? Not how many times eac id comes up? Quote Link to comment https://forums.phpfreaks.com/topic/65152-solved-database-question/#findComment-325298 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.