Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > General > Member Archives
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Top Thread Starter Details »»
Top Thread Starter
Version: , by Boofo Boofo is offline
Developer Last Online: Jun 2012 Show Printable Version Email this Page

Version: Unknown Rating:
Released: 05-18-2003 Last Update: Never Installs: 0
 
No support by the author.

Can someone please help me with a query that will pull the Top thread starter from a forum and the average threads that user has started in that forum? This is the only query I have left to do.

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #12  
Old 05-18-2003, 06:32 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

My host is still using v3.23.54 anyway.
Reply With Quote
  #13  
Old 05-18-2003, 06:33 PM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

threadid would work

of course * works, it's just not needed to use a * if you can use the id field
Reply With Quote
  #14  
Old 05-18-2003, 06:35 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

If you only have 2 thread starters, it always seems to pick the second thread starter. Is there a way to make it pick the first in line if there are more than one with the same amount of threads started?
Reply With Quote
  #15  
Old 05-18-2003, 06:36 PM
filburt1 filburt1 is offline
 
Join Date: Feb 2002
Location: Maryland, US
Posts: 6,144
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Today at 03:31 PM Boofo said this in Post #10
What would you use other than * in that query? It works here. I'm always open to new ideas.
It's considered bad practice to use a * in a query because you're fetching more data than you need to (so vB should die many, many times ).
Reply With Quote
  #16  
Old 05-18-2003, 06:38 PM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

@boofo: add after the order by another condition: , dateline ASC
Reply With Quote
  #17  
Old 05-18-2003, 06:53 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

See? I learned something new here today. I didn't know you could do more than one ORDER BY in a query. Here's what i am using now:

PHP Code:
ORDER BY threads DESCdateline DESC 
When I used ASC, it still picked the second one. With DESC it picks the first one who made a thread if they are equal amounts. I think it should be that way, what do you think?

Thanks again for the bailout and the lesson.
Reply With Quote
  #18  
Old 05-18-2003, 07:00 PM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

hmm dateline DESC would produce the last thread.

dateline descending -> so the thread with the higher dateline (later written) would be elected
Reply With Quote
  #19  
Old 05-18-2003, 07:00 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

filburt, is it bad to use the * in this query then?

$yourposts = $DB_site->query_first("SELECT forum.forumid as forumid, forum.* as foruminfo, COUNT(post.postid) as yourposts FROM forum, thread, post WHERE forum.forumid=thread.forumid AND thread.threadid=post.threadid AND post.userid='".$bbuserinfo[userid]."' AND forum.forumid='$forumid' GROUP BY forumid ORDER BY yourposts DESC LIMIT 1");
Reply With Quote
  #20  
Old 05-18-2003, 07:02 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Today at 03:00 PM Xenon said this in Post #17
hmm dateline DESC would produce the last thread.

dateline descending -> so the thread with the higher dateline (later written) would be elected
Would you also change this to ASC then?

ORDER BY threads DESC
Reply With Quote
  #21  
Old 05-18-2003, 07:18 PM
filburt1 filburt1 is offline
 
Join Date: Feb 2002
Location: Maryland, US
Posts: 6,144
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Today at 04:00 PM Boofo said this in Post #18
filburt, is it bad to use the * in this query then?

$yourposts = $DB_site->query_first("SELECT forum.forumid as forumid, forum.* as foruminfo, COUNT(post.postid) as yourposts FROM forum, thread, post WHERE forum.forumid=thread.forumid AND thread.threadid=post.threadid AND post.userid='".$bbuserinfo[userid]."' AND forum.forumid='$forumid' GROUP BY forumid ORDER BY yourposts DESC LIMIT 1");
Very much so because it's getting all forum columns instead of the ones that are needed. It's great for expandability in the templates but otherwise is just a performance hit.
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 04:35 AM.


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.04321 seconds
  • Memory Usage 2,307KB
  • Queries Executed 25 (?)
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)bbcode_php
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)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_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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete