View Full Version : Extract threads only
akafi
05-07-2017, 11:00 AM
Hi,
I want the SQL query statement in phpmyadmin to extract the main threads with its title and content without posts"replies" .
Thank you
SELECT thread.title, post.pagetext
FROM thread
INNER JOIN post ON thread.firstpostid = post.postid
akafi
05-07-2017, 06:36 PM
SELECT thread.title, post.pagetext
FROM thread
INNER JOIN post ON thread.firstpostid = post.postid
Thank you so much Dave it is work well.
I have another question if i want to change dateline from table thread and transfer it to another table in a row date but with format 0000-00-00 00:00:00
How can i do that?
Thanks
Just wrap the from_unixtime function around the dateline column.
SELECT thread.title, post.pagetext, from_unixtime(thread.dateline) AS date
FROM thread
INNER JOIN post ON thread.firstpostid = post.postid
akafi
05-08-2017, 03:51 AM
Just wrap the from_unixtime function around the dateline column.
SELECT thread.title, post.pagetext, from_unixtime(thread.dateline) AS date
FROM thread
INNER JOIN post ON thread.firstpostid = post.postid
Yeah it is work fine.Thank you Dave you are my hero.Now i transfer the threads and the date into another table but if i want to not include some forums threads into the new table.i have the forums ids and i want to except its threads.How can i do that in the same SQL statement?
By doing a NOT IN check:
SELECT thread.title, post.pagetext, from_unixtime(thread.dateline) AS date
FROM thread
INNER JOIN post ON thread.firstpostid = post.postid
WHERE thread.forumid NOT IN(10,11,12,13)
vBulletin® v3.8.12 by vBS, Copyright ©2000-2024, vBulletin Solutions Inc.