![]() |
How can i get the first post only?
somebody know the way to get only first post ,
ex: i have the topic with 20 reply on it. xxx (owner posted) x1 x2 x3 ... x20 now i want to write a query to get only xxx (owner posted) how can i do it Thank for reading my question |
[SQL]
SELECT * FROM thread LEFT JOIN post ON ( post.postid = thread.firstpostid ) WHERE thread.threadid = AAA [/SQL] (Where AAA is the thread id) |
thank Opserty
|
You may want to just grab the post's info, instead of including thread data, to save on memory.
[sql]SELECT p.* FROM thread AS t LEFT JOIN post AS p ON (p.postid = t.firstpostid) WHERE t.threadid = X[/sql] |
I hate it when people use single letters in sql. :)
|
[sql]SELECT post.*
FROM thread AS thread LEFT JOIN post AS post ON (post.postid = thread.firstpostid) WHERE thread.threadid = X[/sql] Happy now, Paul? :p |
You don't need the "AS thread" or "AS post" if they are the same as the table names no? :p
|
even easier
PHP Code:
PHP Code:
|
wow it's great for coder. big thank all
--------------- Added [DATE]1215142664[/DATE] at [TIME]1215142664[/TIME] --------------- thank for first question. now i got trouble with query my query: Code:
$x = $vbulletin->db->query_read(" the thread auto create perfectly with all infomation but 'pagetext' can not get anything from my query, it's empty. i want to ask who can help me: how can i get 5 threadid and put it on 'pagetext' it's mean 1 new thread with 5 threadid (i got from above query) on its best regard, |
please help me with code
my query: Code:
$x = $vbulletin->db->query_read(" i want to ask who can help me: how can i get 5 threadid and put it on 'pagetext' it's mean 1 new thread with 5 threadid (i got from above query) on its best regard, |
All times are GMT. The time now is 06:09 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 | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|