5

Having trouble in views creating what seems like a very simple query. Display the number (count) of nodes of a given type. I'm not finding the option in any obvious place...

How to?

sepehr
  • 17,110
  • 7
  • 81
  • 119
Michael D
  • 621
  • 1
  • 7
  • 23

2 Answers2

6

You want the Views Group By module. Some more details about this module (from its project page):

This module enriches Views2 functionality with SQL Grouping and Aggregation capabilities.

Ever wanted to design a view that displays top terms for a specific node type and number of nodes for each top term? You could not build such query before, but now you can.

A new field group: SQL Aggregation is added, in Views, once you install the module. The field group has one available field: SQL Aggregation: Group By Fields. The field allows to configure many aspects of "group by" SQL clause and "count()" fields.

Currently only SQL COUNT() function is available due to a limitation in Views2 API. We are working on a Views2 patch to overcome the limitation. Patch will be submitted to Views2 project and, hopefully, applied shortly thereafter.

Community
  • 1
  • 1
Mike Crittenden
  • 5,779
  • 6
  • 47
  • 74
2

Maybe instead of views it is better to use light custom SQL-query, something like this http://drupal.org/node/105375#comment-1095529

Sorlag
  • 21
  • 2