Code: Select all
SELECT t . * , i.icons_url, i.icons_width, i.icons_height, tp.topic_posted, f.forum_name, f.forum_type, f.forum_flags
FROM phpbb3_topics t
LEFT JOIN phpbb3_topics_posted tp ON ( t.topic_id = tp.topic_id
AND tp.user_id =2 )
LEFT JOIN phpbb3_forums f ON f.forum_id = t.forum_id
LEFT JOIN phpbb3_icons i ON t.icon_id = i.icons_id
WHERE (
f.forum_recent_topics =1
AND t.topic_id NOT
IN ( 7, 11 )
AND t.forum_id
IN ( 7, 9, 10, 11 )
)
OR t.topic_type
IN ( 3 )
GROUP BY t.topic_last_post_id
ORDER BY t.topic_last_post_time DESC
LIMIT 4