Reset Drupal Comment Count

The following SQL code will recalculate comment counts for all nodes on your site.

update node_comment_statistics ncs set comment_count = (select count(*) from comment c where c.nid = ncs.nid) where 1=1

As with all such things, you should take a backup before running the script and run at your own risk. That said, it's basically safe to run and re-run this script whenever you like.

Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
To prevent automated spam submissions leave this field empty.