![]() |
Making my query more efficient
I have a query that looks up the last ten threads that the user has participated in. I also have it lookup the pagetext field of the last post for the title link. The problem I have is, I cannot figure out how to query the last post without running the query in another loop causing an additional ten queries to run.
Code:
$getthreads = $DB_site->query(" |
Use the IN construct. Assemble all of the threadids in question and then run the single query:
[sql] SELECT dateline, pagetext, threadid, postid FROM {TABLE_PREFIX}post WHERE threadid IN ($threadids) [/sql] Implode the array in question using commas to the variable $threadids. |
Quote:
Thanks filburt |
All times are GMT. The time now is 01:45 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 | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|