Score:0

Counting node type in View throws SQL error

cn flag

I have field Content:Type that I aggregate with COUNT to show the number of nodes of that specific content type. But I get this SQL error:

SQLSTATE[42000]: Syntax error or access violation: 1140 In aggregated query without GROUP BY, expression #1 of SELECT list contains nonaggregated column 'db.node_field_data.nid'; this is incompatible with sql_mode=only_full_group_by: SELECT "node_field_data"."nid" AS "nid", COUNT(node_field_data.type) AS "node_field_data_type" FROM "node_field_data" "node_field_data" WHERE ("node_field_data"."status" = :db_condition_placeholder_0) AND ("node_field_data"."type" IN (:db_condition_placeholder_1)); Array ( [:db_condition_placeholder_0] => 1 [:db_condition_placeholder_1] => content_type )

Kevin avatar
in flag
Did you add any GROUP BY on each aggregated filter?
0711master avatar
cn flag
Hm, no, and I don't see any possibility to do that...
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.