在Drupal在统计记录的数量
2016-05-30 10:33
323 查看
原文在这里
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:
Edit your view and enable Views aggregations:
Remove default sort criteria.
Add fields “Content: Type” and “Content: Nid”:
Select COUNT function for Content: Nid:
To see what happens just turn on checkbox “Show the SQL query” at global Views settings page.
So, we are grouping nodes by node_type and calculating count for this groups.
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:
Edit your view and enable Views aggregations:
Remove default sort criteria.
Add fields “Content: Type” and “Content: Nid”:
Select COUNT function for Content: Nid:
To see what happens just turn on checkbox “Show the SQL query” at global Views settings page.
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.
相关文章推荐
- Struts2学习(每天一点进步)
- MYSQL学习笔记2--mysql 静态和动态plugin
- win10下 解决系统进程占用80端口
- 第二阶段冲刺02
- SDCycleScrollView 添加初始滚动页码
- Java学习一
- JDBC(一)
- html文字有光晕
- JavaScript中apply()与call()的区别
- JNDI(一) 之 Naming and Directory Concepts
- valgrind 的使用简介
- [leetcode] 【数组】 137. Single Number II
- Windows系统中如何连接远程终端
- Android-PullToRefresh 使用心得
- [ActionScript 3.0] 根据xml属性查找相应xml节点,递归函数。
- xss和csrf攻击
- json
- 跳转activity时出现空白界面问题解决笔记
- iOS helper
- Android之AlarmManager