我是靠谱客的博主 无限舞蹈,这篇文章主要介绍在Drupal在统计记录的数量,现在分享给大家,希望可以做个参考。

原文在这里

http://drupal.stackexchange.com/questions/20705/count-results-in-views-using-aggregation


Yes, it is possible in Views 3 out of the box.
The idea is the same as in SQL aggregations. Lets see an example:

  1. Edit your view and enable Views aggregations:
    enable views aggregations

  2. Remove default sort criteria.

  3. Add fields “Content: Type” and “Content: Nid”: enter image description here
    Select COUNT function for Content: Nid: enter image description here

To see what happens just turn on checkbox “Show the SQL query” at global Views settings page.

复制代码
1
2
3
4
5
6
SELECT node.type AS node_type, COUNT(node.nid) AS nid FROM {node} node WHERE (( (node.status = '1') )) GROUP BY node_type LIMIT 10 OFFSET 0

So, we are grouping nodes by node_type and calculating count for this groups.


最后

以上就是无限舞蹈最近收集整理的关于在Drupal在统计记录的数量的全部内容,更多相关在Drupal在统计记录内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(95)

评论列表共有 0 条评论

立即
投稿
返回
顶部