title: Sequelize - MySQL error: SELECT list is not in GROUP BY clause
body: <p>I have this function which returns the categories containing the product with the lowest price.</p>
  <pre><code>async getAllWithMinPrice(req, res, next) {
    try {
      const categories = await Category.findAll({
        attributes: [&quot;id&quot;, &quot;name&quot;],
        group: [&quot;products.id&quot;],
        include: [
          {
            model: Product,
            attributes: [
              &quot;id&quot;,
              &quot;name&quot;,
              &quot;pluralName&quot;,
              &quot;description&quot;,
              &quot;image&quot;,
              [Sequelize.fn(&quot;MIN&quot;, Sequelize.col(&quot;price&quot;)), &quot;minPrice&quot;],
            ],
            include: [
              {
                model: Type,
                attributes: [],
              },
            ],
          },
        ],
      });
      return res.json(categories);
    } catch (e) {
      return next(ApiError.badRequest(e.message ? e.message : e));
    }
  }
  </code></pre>
  <p>But I am getting an error: <code>&quot;Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'fotoluks.category.id' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by&quot;</code>.</p>
  <p>On my test server, I just disabled <code>ONLY_FULL_GROUP_BY</code> in MySQL, but I don't have permission to do so on the current server.</p>
  <p>As far as I understand, to solve this problem, you need to use <code>any_value</code>, but I just can't figure out how to do it in Sequelize.</p>
  <p>P.S. In a similar function, I had exactly the same error, then I solved it by simply adding <code>attributes: []</code>, but in this case I can't do it.</p>