# SQL-Error in Reports

**URL:** <https://forum.mautic.org/t/sql-error-in-reports/25680>\
**Category:** Product Support\
**Created:** [October 13, 2022, 7:59pm UTC](https://forum.mautic.org/t/sql-error-in-reports/25680 "2022-10-13T19:59:48Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![iparker](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/iparker/32/1936_2.png) [@iparker](https://forum.mautic.org/u/iparker)\
**Post date:** [October 13, 2022, 7:59pm UTC](https://forum.mautic.org/t/sql-error-in-reports/25680/1 "2022-10-13T19:59:48Z")

</div>

Hello,

I try to create my first email-reports in mautic.

I create a report for send emails like this:

 ![Bildschirmfoto vom 2022-10-13 21-39-45](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/2X/7/7b59fb1bfb3038a71282285de691717ee2ee0e11.png)

With this settings it works and I can see the results of the report.

But when I change the report and add something like the send-date or the campaign name to the columns the report is not working anymore and I get an error like this in the log:

```auto
[2022-10-13 19:58:57] mautic.CRITICAL: Uncaught PHP Exception Doctrine\DBAL\Exception\DriverException: "An exception occurred while executing 'SELECT count(*) FROM (SELECT `e`.`id` AS e_id, `e`.`subject` AS subject1, `es`.`date_sent` AS date_sent, COUNT(e.sent_count) AS 'COUNT e.sent_count', SUM(es.is_read) AS 'SUM es.is_read', SUM(IF(cut.hits is NULL, 0, 1)) AS 'SUM is_hit', SUM(IFNULL(cut.unique_hits, 0)) AS 'SUM unique_hits', SUM(IF(dnc.id IS NOT NULL AND dnc.reason=1, 1, 0)) AS 'SUM unsubscribed', SUM(IF(dnc.id IS NOT NULL AND dnc.reason=2, 1, 0)) AS 'SUM bounced', SUM(es.viewed_in_browser) AS 'SUM es.viewed_in_browser' FROM email_stats es LEFT JOIN emails e ON e.id = es.email_id LEFT JOIN lead_donotcontact dnc ON es.email_id = dnc.channel_id AND dnc.channel='email' AND es.lead_id = dnc.lead_id LEFT JOIN (SELECT COUNT(ph.id) AS hits, COUNT(DISTINCT(ph.redirect_id)) AS unique_hits, cut2.channel_id, ph.lead_id FROM channel_url_trackables cut2 INNER JOIN page_hits ph ON cut2.redirect_id = ph.redirect_id AND cut2.channel_id = ph.source_id WHERE (cut2.channel = 'email' AND ph.source = 'email') AND (cut2.channel_id IN (?)) GROUP BY cut2.channel_id, ph.lead_id) cut ON es.email_id = cut.channel_id AND es.lead_id = cut.lead_id WHERE (es.date_sent IS NULL OR (es.date_sent BETWEEN ? AND ?)) AND (e.id = 500) GROUP BY e.id) c' with params ["500", "2022-08-01 00:00:00", "2022-10-13 19:58:57"]: SQLSTATE[42000]: Syntax error or access violation: 1055 Expression #3 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'mautic.es.date_sent' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by" at /var/www/mailer.promotionbasis.de/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php line 128 {"exception":"[object] (Doctrine\\DBAL\\Exception\\DriverException(code: 0): An exception occurred while executing 'SELECT count(*) FROM (SELECT `e`.`id` AS e_id, `e`.`subject` AS subject1, `es`.`date_sent` AS date_sent, COUNT(e.sent_count) AS 'COUNT e.sent_count', SUM(es.is_read) AS 'SUM es.is_read', SUM(IF(cut.hits is NULL, 0, 1)) AS 'SUM is_hit', SUM(IFNULL(cut.unique_hits, 0)) AS 'SUM unique_hits', SUM(IF(dnc.id IS NOT NULL AND dnc.reason=1, 1, 0)) AS 'SUM unsubscribed', SUM(IF(dnc.id IS NOT NULL AND dnc.reason=2, 1, 0)) AS 'SUM bounced', SUM(es.viewed_in_browser) AS 'SUM es.viewed_in_browser' FROM email_stats es LEFT JOIN emails e ON e.id = es.email_id LEFT JOIN lead_donotcontact dnc ON es.email_id = dnc.channel_id AND dnc.channel='email' AND es.lead_id = dnc.lead_id LEFT JOIN (SELECT COUNT(ph.id) AS hits, COUNT(DISTINCT(ph.redirect_id)) AS unique_hits, cut2.channel_id, ph.lead_id FROM channel_url_trackables cut2 INNER JOIN page_hits ph ON cut2.redirect_id = ph.redirect_id AND cut2.channel_id = ph.source_id WHERE (cut2.channel = 'email' AND ph.source = 'email') AND (cut2.channel_id IN (?)) GROUP BY cut2.channel_id, ph.lead_id) cut ON es.email_id = cut.channel_id AND es.lead_id = cut.lead_id WHERE (es.date_sent IS NULL OR (es.date_sent BETWEEN ? AND ?)) AND (e.id = 500) GROUP BY e.id) c' with params [\"500\", \"2022-08-01 00:00:00\", \"2022-10-13 19:58:57\"]:\n\nSQLSTATE[42000]: Syntax error or access violation: 1055 Expression #3 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'mautic.es.date_sent' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by at /var/www/mailer.promotionbasis.de/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php:128, Doctrine\\DBAL\\Driver\\PDO\\Exception(code: 42000): SQLSTATE[42000]: Syntax error or access violation: 1055 Expression #3 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'mautic.es.date_sent' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by at /var/www/mailer.promotionbasis.de/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDO/Exception.php:18, PDOException(code: 42000): SQLSTATE[42000]: Syntax error or access violation: 1055 Expression #3 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'mautic.es.date_sent' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by at /var/www/mailer.promotionbasis.de/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:112)"} []

```

Hope someone can help me with this.

Best regards,

Timo

---

<div class="post-metadata">

**Author:** ![gary.harrison](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/gary.harrison/32/2864_2.png) [@gary.harrison](https://forum.mautic.org/u/gary.harrison)\
**Post date:** [October 14, 2022, 3:14pm UTC](https://forum.mautic.org/t/sql-error-in-reports/25680/2 "2022-10-14T15:14:53Z")

</div>

What i’ve noticed is that not all fields support the grouping option. The report writer seems like it has so much potential, but there is not much information about it…
