title: Sequelizejs error to run function on columns - check_ungrouped_columns_walker in
body: <p>I want to run a function in the attribute and get different between <code>startDate</code> and <code>endDate</code>. But when I execute the code get this error: </p>
  
  <blockquote>
    <p>column "Signals.id" must appear in the GROUP BY clause or
    be used in an aggregate function</p>
  </blockquote>
  
  <pre><code>const lastData = await psql.Signals.findAll({
      attributes: [
       "id",
       "strategy",
       "type",
       "symbol",
       "name",
       "timeframe",
       "status",
       "startDate",
       "endDate",
       [
        Sequelize.literal('EXTRACT(DAY FROM MAX("startDate")-MIN("endDate"))'),
        "DateDifference"
       ],
       "positionsData"
      ],
      where: {
       isMain: true,
       strategy: {
        [Op.in]: ["21", "22"]
       }
      },
      order: [["id", "DESC"]],
      limit: 50,
      raw: true
     })
  </code></pre>
  
  <p>The expected SQL code by Sequelizejs is: </p>
  
  <pre><code>SELECT "id", "strategy", "type", "symbol", "name", "timeframe", "status", "startDate", "endDate", EXTRACT(DAY FROM MAX("startDate")-MIN("endDate")) AS "DateDifference", "positionsData" FROM "signals" AS "Signals" WHERE "Signals"."isMain" = true AND "Signals"."strategy" IN ('21', '22') ORDER BY "Signals"."id" DESC LIMIT 50;
  </code></pre>
  
  <p>Can anybody help me? What is wrong?!</p>