Ok makes sense, just making sure that the linking of entry to topic is happening.
Here is the ‘ultimate’ solution:
{exp:query sql="SELECT count(exp_forum_posts.topic_id) AS thread_counter, exp_weblog_titles.forum_topic_id as topic_link_id
FROM exp_weblog_titles
LEFT OUTER JOIN exp_forum_posts
ON (exp_weblog_titles.forum_topic_id = exp_forum_posts.topic_id)
WHERE exp_weblog_titles.entry_id='{entry_id}'
GROUP BY exp_weblog_titles.entry_id;"}
{if thread_counter =="0"}
Be First to <a href="http://{path=forums/viewthread/{topic_link_id}}">Discuss</a>
{if:else}
Forum Replies: [<a href="http://{path=forums/viewthread/{topic_link_id}}">{thread_counter}</a>]
{/if}
{/exp:query}
This could also be a nice way (for those running forums) to unload some of the ‘comment maintenance’ and perhaps show these links after the commenting on entry had expired. This way discussions can continue in forums while entry page stays free from load of possibly 100s of comments. In other words I would embed this query on entry view page as well. 😉