The Summary Fields extension creates read-only custom data fields that extend Contact and are automatically populated with up-to-date totals such as total lifetime contributions, last contribution amount, last attended event, etc.
Other
8
stars
29
forks
source link
Total lifetime contributions causes crash - SQL error #71
Expression #2 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'dmasterciv_yzj1n.trigger_table.contribution_id' which is not functionally dependent on columns in GROUP BY clause
The bit it's complaining about is:
SELECT contact_id, (SELECT IF(SUM(total_amount) IS NULL, 0, SUM(total_amount))
I suspect this is a MySQL/MariaDB version thing. Previous versions I know reutrned a random value when there was no aggregate function and a field was not part of GROUP BY.
In theory, the values within the inner (SELECT) should all be the same (I haven't quite understood why they're being calculated multiple times which surely has a perfomance hit) and therefore any of them will do. I chose MIN().
I'm seeing this db error:
The bit it's complaining about is:
And I think this would fix it and be cleaner:
I suspect this is a MySQL/MariaDB version thing. Previous versions I know reutrned a random value when there was no aggregate function and a field was not part of GROUP BY.
In theory, the values within the inner (SELECT) should all be the same (I haven't quite understood why they're being calculated multiple times which surely has a perfomance hit) and therefore any of them will do. I chose MIN().