Hi there
I catch error from latest build
PDOException: SQLSTATE[42803]: Grouping error: 7 ERROR: column "n.vid" must appear in the GROUP BY clause or be used in an aggregate function LINE 1: SELECT n.nid AS nid, n.vid AS vid, n.title AS title, n.type ... ^: SELECT n.nid AS nid, n.vid AS vid, n.title AS title, n.type AS type, n.created AS ncreated, COUNT(*) AS cnt FROM {node} n LEFT OUTER JOIN {taxonomy_index} ti ON n.nid = ti.nid WHERE (n.status = :db_condition_placeholder_0) AND (n.type IN (:db_condition_placeholder_1)) AND (ti.tid IN (:db_condition_placeholder_2, :db_condition_placeholder_3)) AND (n.nid NOT IN (:db_condition_placeholder_4)) GROUP BY n.nid ORDER BY cnt DESC, n.created DESC, n.nid DESC LIMIT 5 OFFSET 0; Array ( [:db_condition_placeholder_0] => 1 [:db_condition_placeholder_1] => news [:db_condition_placeholder_2] => 29081 [:db_condition_placeholder_3] => 29045 [:db_condition_placeholder_4] => 39893 ) in function relevant_content_get_nodes() (string 275 in file /****/relevant_content/relevant_content.module).
I fix this like that
- $query->groupBy('n.nid')->orderBy('cnt', 'DESC')->orderBy('n.created', 'DESC')->orderBy('n.nid', 'DESC')->range(0, $limit);
+ $query->groupBy('n.nid, n.vid, n.title, n.type, n.created')->orderBy('cnt', 'DESC')->orderBy('n.created', 'DESC')->orderBy('n.nid', 'DESC')->range(0, $limit);
Comments
Comment #1
nicholasthompsonI believe this is fixed in dev... All instances of db_query() have been replace with appropriate DBTNG API calls.
If you could review and close (or re-open) as appropriate, that'd be awesome.