The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
![]()
a) If i have a threadid, what is the most efficient way to find out if a specific userid has posted in that thread?
b) if i have a query which returns a list of threadids, what is the most efficient join or similar to use in order to establish on a line by line basis whether the same specific userid has posted in that thread? Thanks in advance. Simon |
#2
|
||||
|
||||
![]() Quote:
if ($foo) {user/thread found} b) $q = $db->query_read("select distinct threadid from post where userid=blah1 and threadid in (list of theads)") while ($res=$db->fetch_array($q)) { $res[threadid].... |
#3
|
|||
|
|||
![]()
hmmm.. ok, option a) thank you, that's what I have now.
option b) isn't quite what I meant.. What i meant is... if I already have a query such as : SELECT threadid from specialtable .... what's the most efficient way include a column in the returned results which establishes whether userid x has posted in that thread. So I would end up with results with columns [specialtable.threadid] and [useridhasposted or useridpostcount or similar] Thanks in advance Simon |
#4
|
||||
|
||||
![]() Quote:
FROM specialtable sp LEFT OUTER JOIN post USING (threadid) WHERE userid=blah GROUP BY sp.threadid the [postid] field will contain null if there are no posts, but the count will still be 1 (because there is 1 row in the result table if you want to ignore null results then just do a join instead of a left outer join |
![]() |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|