简体   繁体   English

在Drupal中创建SQL查询

[英]Creating an SQL query in drupal

Hi I'm not sure if this is the best way to do this. 您好,我不确定这是否是最好的方法。 I am familiar with Views, but I'm interested in outputting to a specific variable, not a table, list, etc. 我对Views很熟悉,但是我对输出到特定变量而不是表,列表等感兴趣。

Here is what I'm trying to do: for each taxonomy term, echo the term, count how many users have a node with that term and echo that count. 这是我要尝试的操作:对于每个分类术语,回显该术语,计算有多少用户拥有该术语的节点,然后回显该计数。

This is not possible with the default Views module as it doesn't offer this kind of aggregation function. 对于默认的Views模块,这是不可能的,因为它不提供这种聚合功能。 However, with the Views Aggregator Plus module you can add the desired behaviour. 但是,使用Views Aggregator Plus模块可以添加所需的行为。 When you would get a (grouped) table in standard Views, this module is able to count rows for each group (and do much more like sum and average) so you would get a single row per taxonomy term and the number of nodes/users associated to that term. 当您在标准视图中获得一个(分组的)表时,该模块能够对每个组的行进行计数(并且执行更多的操作如求和和平均值),因此每个分类术语和节点/用户数将获得一行与该词相关的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM