vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Need a query to find the number of Friends members have (https://vborg.vbsupport.ru/showthread.php?t=249892)

Mobo 09-04-2010 04:55 AM

Need a query to find the number of Friends members have
 
Hello all,

I am trying to find a query I can run that will output the number of Friends/Buddies members on my site have. Can someone please help with this?

Thanks,

Keith

Boofo 09-04-2010 05:46 AM

Where are you wanting this to show up?

Mobo 09-07-2010 09:57 AM

I just need to run it in the ACP to find the members with X number of Friends.

kh99 09-08-2010 11:55 AM

There's a field called "friendcount' in the user table, so maybe

Code:

SELECT friendcount FROM vb_user WHERE userid=100

although I haven't tried it. Of course "vb_" should be whatever your table prefix actually is, and "100" should be the id of the user you're insterested in.

Mobo 09-11-2010 03:34 AM

Thanks kh99, that did tell me the number of Friends for the use entered, but what I'm looking for is a query that will output the usernames of members that X number of Friends or more. Sorry, I should have been more clear on my needs.

sulasno 09-11-2010 04:42 AM

not sure whether this would work

select friendcount,username,userid from vb_user;

Mobo 09-11-2010 04:57 AM

That did work, any way to sort the results from most to least Friends? Right now randomly displayed across 64 pages.

ForumsMods 09-11-2010 05:27 AM

Use this:
Code:

SELECT username, friendcount FROM vb_user WHERE friendcount >= 100
Replace vb with your table prefix and change 100.

Mobo 09-11-2010 05:31 AM

The query sulasno posted worked, I added
Code:

ORDER BY friendcount DESC
to it to get it to sort the output by username with the most Friends first.

Thanks for everyone's help.

--------------- Added [DATE]1284190422[/DATE] at [TIME]1284190422[/TIME] ---------------

vB Style, yours worked as well allowing me to set the cutoff number for Friends.

kh99 09-11-2010 12:10 PM

Quote:

Originally Posted by Mobo (Post 2096555)
Thanks kh99, that did tell me the number of Friends for the use entered, but what I'm looking for is a query that will output the usernames of members that X number of Friends or more. Sorry, I should have been more clear on my needs.

I should have realized that you'd want to output more than the number, I just wasn't thinking.


All times are GMT. The time now is 07:49 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01723 seconds
  • Memory Usage 1,725KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_code_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete