With the Advanced setting "Use aggregation: Yes", I'm getting an error referring to the first column that has "Display calculation" ticked in a simple View formatted as "View Calc Table".

SQLSTATE[42000]: Syntax error or access violation: 1056 Can't group on 'count__node_nid'

Using MAMP stack as follows:
Database system MySQL 5.5.25
Apache/2.2.22 (Unix) mod_ssl/2.2.22 OpenSSL/0.9.8x DAV/2 PHP/5.4.4

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

RdeBoer’s picture

Issue summary: View changes

Mention MAMP stack and version numbers

RdeBoer’s picture

Issue summary: View changes

typo

ibraaheem’s picture

Issue summary: View changes

I have this issue too.

Niremizov’s picture

Priority: Normal » Major
FileSize
1.99 KB

I have made a patch. Should be working fine after applying.

Niremizov’s picture

Status: Active » Needs review

Changed status.

Niremizov’s picture

Niremizov’s picture

I have uploaded patch to the realted issue "Add grouping support for views calc" - https://www.drupal.org/node/140665#comment-9017249 - This patched is based on #2.

Niremizov’s picture

Deleted reference here cause it is already added in related issue.

mgifford’s picture

This patch still applies nicely, but I'm having trouble replicating the problem.

Is there a default view that you're using that we could compare this with? I'm just trying to see on SimplyTest.me.

Niremizov’s picture

Ok. To replicate:

1) Create new view that shows content, set display format: Views Calc Table
2) To the fields list add Nid. (Inside views FIELDS section)
3) Enable aggregation mode. (Inside views OTHER section)
4) Go into Views Calc Table style settings(Inside FORMAT section). Check checkbox Display Calculation for NID field, and for example select Count method.

After that save view and try to preview it...

SQLSTATE[42000]: Syntax error or access violation: 1056 Can't group on 'count__nid_1'

dobrzyns’s picture

Status: Needs review » Reviewed & tested by the community

This patch applies nicely and resolves the issue. Upon enabling Aggregation and Display Calculation for a NID or Title field, the sql error no longer appears.