I have a query to get new topics for my forum but it does not work as it should. The problem is that it excludes topics that user has viewed before the new post was made. It works if user has not visited the topic at all.
SELECT $select FROM forum_topics LEFT OUTER JOIN forum_topic_views ON forum_topics.id = forum_topic_views.topic WHERE (forum_topic_views.id IS null or (forum_topics.last_update>forum_topic_views.time and forum_topic_views.user=$user)) $filter_nw ORDER BY forum_topics.last_update DESC
$filter_nw can be something like this (but it does not seem to effect the problem i have)
WHERE forum_topics.category=$category AND forum_topics.subcategory=$subcategory