vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   query help (https://vborg.vbsupport.ru/showthread.php?t=165202)

Lpspider 12-15-2007 04:13 AM

query help
 
Okay, what I'd like to do is query the database to output only unanswered threads from specific forums.

I'm sorry that i'm basically asking for help but I haven't worked with creating a query in quite a while.

Could anyone help me out? Thanks.

Kirk Y 12-15-2007 05:00 AM

Basic example:
Code:

SELECT threadid, title
FROM thread
WHERE replycount = 0 AND forumid IN (X,Y,Z)


Lpspider 12-15-2007 11:29 PM

Thank you. This helps very much. Would it be possible to somehow restrict the replies from the user who posted the original thread in counting for the replycount? So if the user posts a thread and replies to it twice, the results from the query will still be the same as replycount = 0, even though technically there were two replies (from the thread-posting user)?

Kirk Y 12-16-2007 12:49 AM

Try this:
Code:

SELECT threadid, title
FROM thread
WHERE (replycount = 0 OR postusername = lastposter) AND forumid IN (X,Y,Z)



All times are GMT. The time now is 03:30 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.01057 seconds
  • Memory Usage 1,709KB
  • 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
  • (2)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (4)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