Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 05-24-2007, 10:51 PM
imported_rom imported_rom is offline
 
Join Date: Apr 2005
Posts: 8
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Query to get posts per board?

What would be the query to get the results of member posts per board?

ie. with seven boards...

member name id1 id2 id3 id4 id5 id6 id7
member1 12 18 14 16 23 97 1004
member2 13 12 19 26 28 1207 404

etc.
Reply With Quote
  #2  
Old 05-24-2007, 11:12 PM
Eikinskjaldi's Avatar
Eikinskjaldi Eikinskjaldi is offline
 
Join Date: Feb 2006
Location: Hell, never looked better
Posts: 572
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

When you say "board" do you mean separate installations of vb each with its own database (I assume all running on the same server) or a board on which you allow multiple logins per member?
Reply With Quote
  #3  
Old 05-25-2007, 01:06 AM
imported_rom imported_rom is offline
 
Join Date: Apr 2005
Posts: 8
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Eikinskjaldi View Post
When you say "board" do you mean separate installations of vb each with its own database (I assume all running on the same server) or a board on which you allow multiple logins per member?
I apologize.

One installation of vB, multiple forums (sorry I said boards). No multiple logins per member.

We are a sports community and want to have a poll. But to vote in the poll, members must have over 100 posts on forums where the forum id is in (2,5,10,12,15).

Thanks!
Reply With Quote
  #4  
Old 05-25-2007, 03:30 AM
Eikinskjaldi's Avatar
Eikinskjaldi Eikinskjaldi is offline
 
Join Date: Feb 2006
Location: Hell, never looked better
Posts: 572
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by imported_rom View Post
I apologize.

One installation of vB, multiple forums (sorry I said boards). No multiple logins per member.

We are a sports community and want to have a poll. But to vote in the poll, members must have over 100 posts on forums where the forum id is in (2,5,10,12,15).

Thanks!
Ahh, well in that case...

SELECT count(*) as 'total' FROM post p join thread t USING(threadid) where forumid in (2,5,10,12,15) and userid=whatever

or

SELECT count(*) as 'total' FROM post p join thread t USING(threadid) where forumid in (2,5,10,12,15) and username=whatever
Reply With Quote
  #5  
Old 05-25-2007, 04:36 AM
imported_rom imported_rom is offline
 
Join Date: Apr 2005
Posts: 8
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Eikinskjaldi View Post
Ahh, well in that case...

SELECT count(*) as 'total' FROM post p join thread t USING(threadid) where forumid in (2,5,10,12,15) and userid=whatever

or

SELECT count(*) as 'total' FROM post p join thread t USING(threadid) where forumid in (2,5,10,12,15) and username=whatever
Well we have 4K+ members so I wanted to get a list that tells me which members (by member name) qualify with 100 posts and how many total posts.

THANKS!!!!!!
Reply With Quote
  #6  
Old 05-25-2007, 05:54 AM
Eikinskjaldi's Avatar
Eikinskjaldi Eikinskjaldi is offline
 
Join Date: Feb 2006
Location: Hell, never looked better
Posts: 572
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

SELECT userid, username, count(*) as 'total' FROM post p join thread t USING(threadid) where forumid in (2,5,10,12,15) group by userid order by total desc
Reply With Quote
  #7  
Old 05-25-2007, 06:14 AM
imported_rom imported_rom is offline
 
Join Date: Apr 2005
Posts: 8
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Eikinskjaldi View Post
SELECT userid, username, count(*) as 'total' FROM post p join thread t USING(threadid) where forumid in (2,5,10,12,15) group by userid order by total desc
Thank you!
Reply With Quote
  #8  
Old 05-25-2007, 10:06 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Eikinskjaldi View Post
SELECT userid, username, count(*) as 'total' FROM post p join thread t USING(threadid) where forumid in (2,5,10,12,15) group by userid order by total desc
Wow, I can hardly decipher that .
[sql]SELECT userid, username, count(*) AS total
FROM post p
JOIN thread t USING(threadid) WHERE forumid IN (2,5,10,12,15)
GROUP BY userid
ORDER BY total DESC[/sql]
Reply With Quote
  #9  
Old 05-30-2007, 10:41 PM
Eikinskjaldi's Avatar
Eikinskjaldi Eikinskjaldi is offline
 
Join Date: Feb 2006
Location: Hell, never looked better
Posts: 572
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thought of something else that might help

[sql]SELECT userid, username, count(*) AS total
FROM post p
JOIN thread t USING(threadid) WHERE forumid IN (2,5,10,12,15)
GROUP BY userid
HAVING total >= 100
ORDER BY total DESC[/sql]
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 07:56 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04549 seconds
  • Memory Usage 2,241KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (5)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (9)post_thanks_box
  • (9)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (9)post_thanks_postbit_info
  • (9)postbit
  • (9)postbit_onlinestatus
  • (9)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete