Resultados da pesquisa Resultados da Web ERROR: invalid reference to FROM-clause
Resultados da pesquisa Resultados da Web ERROR: invalid reference to FROM-clause
我正在尝试 运行 使用 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 子句引用错误,我必须为此使用横向连接,有什么问题吗?
看起来这个错误来自 postgres 版本,我更新了并且查询工作正常。
我正在尝试 运行 使用 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 子句引用错误,我必须为此使用横向连接,有什么问题吗?
看起来这个错误来自 postgres 版本,我更新了并且查询工作正常。