简体   繁体   中英

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.

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. However, with the Views Aggregator Plus module you can add the desired behaviour. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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