await models.messengerMessages.findAll({
include: [{
model: models.messengers,
as: 'messengerMessages',
include: [{
model: models.users,
as: 'userMessenger',
}]
}],
group: ['messengerMessages->userMessenger.id']
})
[SequelizeDatabaseError]: column "messenger_messages.id" must appear in the GROUP BY clause or be used in an aggregate function
SELECT "messenger_messages"."id", "messenger_messages"."messenger_id", "messenger_messages"."admin_id", "messenger_messages"."text", "messenger_messages"."status", "messenger_messages"."data", "messenger_messages"."deletedAt", "messenger_messages"."createdAt", "messenger_messages"."updatedAt", "messengerMessages"."id" AS "messengerMessages.id", "messengerMessages"."user_id" AS "messengerMessages.user_id", "messengerMessages"."messenger_id" AS "messengerMessages.messenger_id", "messengerMessages"."login" AS "messengerMessages.login", "messengerMessages"."type" AS "messengerMessages.type", "messengerMessages"."status" AS "messengerMessages.status", "messengerMessages"."data" AS "messengerMessages.data", "messengerMessages"."deletedAt" AS "messengerMessages.deletedAt", "messengerMessages"."createdAt" AS "messengerMessages.createdAt", "messengerMessages"."updatedAt" AS "messengerMessages.updatedAt", "messengerMessages->userMessenger"."id" AS "messengerMessages.userMessenger.id", "messengerMessages->userMessenger"."login" AS "messengerMessages.userMessenger.login", "messengerMessages->userMessenger"."email" AS "messengerMessages.userMessenger.email", "messengerMessages->userMessenger"."password" AS "messengerMessages.userMessenger.password", "messengerMessages->userMessenger"."role" AS "messengerMessages.userMessenger.role", "messengerMessages->userMessenger"."status" AS "messengerMessages.userMessenger.status", "messengerMessages->userMessenger"."status_email" AS "messengerMessages.userMessenger.status_email", "messengerMessages->userMessenger"."ref" AS "messengerMessages.userMessenger.ref", "messengerMessages->userMessenger"."language" AS "messengerMessages.userMessenger.language", "messengerMessages->userMessenger"."balance" AS "messengerMessages.userMessenger.balance", "messengerMessages->userMessenger"."data" AS "messengerMessages.userMessenger.data", "messengerMessages->userMessenger"."deleted_at" AS "messengerMessages.userMessenger.deleted_at", "messengerMessages->userMessenger"."createdAt" AS "messengerMessages.userMessenger.createdAt", "messengerMessages->userMessenger"."updatedAt" AS "messengerMessages.userMessenger.updatedAt" FROM "messenger_messages" AS "messenger_messages" LEFT OUTER JOIN "messengers" AS "messengerMessages" ON "messenger_messages"."messenger_id" = "messengerMessages"."id" LEFT OUTER JOIN "users" AS "messengerMessages->userMessenger" ON "messengerMessages"."user_id" = "messengerMessages->userMessenger"."id" GROUP BY "messengerMessages->userMessenger"."id";