Need help with mySQL query

cmeinck

Well-known member
I need help finding threads that have zero replies and a character count below a certain number. So for example, I would like a mySQL query that delivers threads with 0 replies and less than 50 characters. On a side note, this would make a great plugin.

Thanks in advance.
 
Fixed. Somehow managed to misread your first post. Here is correct query:
Code:
SELECT t.thread_id FROM `xf_thread` t LEFT JOIN xf_post p ON (t.first_post_id = p.post_id) WHERE t.reply_count = 0 AND LENGTH(p.message) < 50
 
This will give you the post_id

Code:
SELECT xf_post.post_id
FROM xf_thread
INNER JOIN xf_post ON xf_post.post_id = xf_thread.first_post_id
WHERE xf_thread.reply_count=0
AND LENGTH(xf_post.message) > 50

This will give you the thread_id

Code:
SELECT xf_thread.thread_id
FROM xf_thread
INNER JOIN xf_post ON xf_post.post_id = xf_thread.first_post_id
WHERE xf_thread.reply_count=0
AND LENGTH(xf_post.message) > 50
 
When I run these queries and click edit, I get an errors.

Any suggestions on how I can run these queries and use them to check the thin content on my forum? What's the best way to find and export content in a format that would allow me to perform searches within XenForo.
 
Top Bottom