SQL query to count comments for node type I am looking for a SQL query to count all comments for a specific node type. What code should I use to achieve it?
You can use this helper function

function mymodule_get_comment_count_by_node_type($node_type) {
  $query = new EntityFieldQuery();
  $result = $query-&gt;entityCondition('entity_type', 'node')
      -&gt;entityCondition('bundle', $node_type, '=')
      -&gt;execute();
  $nids = array_keys($result['node']);

  $comments = db_select('comment', 'c')
      -&gt;fields('c', array('cid'))
      -&gt;condition('nid', $nids, 'IN')
      -&gt;execute();
  $comments_count = $comments-&gt;rowCount();
  return $comments_count;
}