Count number of results in a View

Posted by Jukebox on Stack Overflow See other posts from Stack Overflow or by Jukebox
Published on 2010-06-01T20:02:40Z Indexed on 2010/06/01 20:13 UTC
Read the original article Hit count: 140

Filed under:
|
|
|
|

I need to count how many people belong in pre-defined groups (this is easy to do in SQL using the SELECT COUNT statement). My Views query runs fine and displays the actual data in my table, but I simply need to know how many results it found.

However there doesn't seem to be a COUNT option in views. I am guessing I am going to have to use some sort of views hook, and then stick the result in the table.

Here's a quick example of what i'm trying to achieve:

My Table
----------------------
Group A | 20 people
Group B | 63 people

and so on.

(I've tried using the Views_Calc module, but I get errors because it is not quite stable yet.)

Anybody know of an easy way to count results in Views?

© Stack Overflow or respective owner

Related posts about php

Related posts about sql