【发布时间】:2020-06-18 17:03:09
【问题描述】:
我需要将我的数组与表格进行比较。
我需要知道数组中存在哪些代码,而表中缺少哪些代码。 以及表中存在哪些代码,而数组中缺少哪些代码。
我正在使用 Node+KnexJS+PostgreSQL:
const myArray = `array['10001517','1509','1524','155400X','903B','910','1009201X']`
let divergence = await app.db.raw(`
select file, t.code as acc_missing
from unnest(${myArray}) file full join
table_a as t
on t.code LIKE file
where t.code is null or file is NULL
AND t.version LIKE '010'
AND t.inst = 300
`)
const errorDivergence = divergence.rows
我当前的查询会这样做,但会产生以下错误:
(node:26060) UnhandledPromiseRejectionWarning: error: FULL JOIN is only supported with merge-joinable or hash-joinable join conditions
【问题讨论】:
标签: sql node.js postgresql outer-join