resultados da pesquisa resultados da web错误:对from子句的引用无效

j9per5c4  于 2021-07-26  发布在  Java
关注(0)|答案(1)|浏览(303)

我正在尝试使用knex.raw()运行查询;

SELECT msg."msgId",
       msg.from_me,
       msg.message,
       msg."dataEnvio",
       msg.id_atendimento,
       msg.caption,
       msg.type,
       msg.leitura,
       msg."errorOnSend",
       msg.resp,
       msg."senderName",
       msg.encaminhada,
       msg.self,
       msg.sent,
       msg.read
FROM tb_atendimento_bot as att
   INNER JOIN LATERAL ((SELECT m.id as msgId,
                               m.from_me,
                               m.message,
                               m.msg_date_envio as dataEnvio,
                               m.id_atendimento,
                               m.caption,
                               m.type,
                               m.leitura,
                               m."errorOnSend",
                               m."quotedMsgBody" as resp,
                               m.sender_name as senderName,
                               m."isForwarded" as encaminhada,
                               m.self,
                               m.sent,
                               m.read
                        from tb_mensagens as m
                        WHERE (m.id_atendimento = att.id)
                        ORDER BY m.id DESC limit 10)) msg
      ON true
WHERE att.id IN(${ids_atendimentos.map(() => '?')})
  AND att.status = true`,
[...ids_atendimentos])

但是它的输出结果是from子句做了一个错误的引用,我必须使用横向连接,有什么问题吗?

55ooxyrt

55ooxyrt1#

看起来这个错误来自postgres版本,我更新了,查询工作正常。

相关问题