# MySQL query using the 'GROUP BY' clause

**URL:** <https://forum.inductiveautomation.com/t/mysql-query-using-the-group-by-clause/81149>\
**Category:** Ignition\
**Tags:** database\
**Created:** [October 30, 2023, 9:02am UTC](https://forum.inductiveautomation.com/t/mysql-query-using-the-group-by-clause/81149 "2023-10-30T09:02:26Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![bkarabinchak.psi](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bkarabinchak.psi/32/83567_2.png) [@bkarabinchak.psi](https://forum.inductiveautomation.com/u/bkarabinchak.psi)\
**Post date:** [October 30, 2023, 11:47am UTC](https://forum.inductiveautomation.com/t/mysql-query-using-the-group-by-clause/81149/4 "2023-10-30T11:47:29Z")

</div>

What @pascal.fragnoud said. If your SQL is set to `sql_mode=only_full_group_by` then every column that is not using an aggregate function has to in your GROUP BY clause.

More info - [sql - Error related to only\_full\_group\_by when executing a query in MySql - Stack Overflow](https://stackoverflow.com/questions/34115174/error-related-to-only-full-group-by-when-executing-a-query-in-mysql)

Seems that you may have already seen this thread though given your attempt to try to change the sql mode. I would just fix the query though instead of changing the mode. It may be a little annoying and more verbose but it will also be more explicit about what is being done. If you truly don't care about what the value of a certain column is in when grouped, there is the `ANY_VALUE()` function.

---

_[View the full topic](https://forum.inductiveautomation.com/t/mysql-query-using-the-group-by-clause/81149)._
