Create a view that displays node count?

Michael D picture Michael D · Jan 30, 2010 · Viewed 8.5k times · Source

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?

Answer

Mike Crittenden picture Mike Crittenden · Jan 30, 2010

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.