diff --git a/modules/entry/back/methods/entry/lastItemBuys.js b/modules/entry/back/methods/entry/lastItemBuys.js index 514052e4b..525e24fdc 100644 --- a/modules/entry/back/methods/entry/lastItemBuys.js +++ b/modules/entry/back/methods/entry/lastItemBuys.js @@ -55,7 +55,6 @@ module.exports = Self => { travel.landed ]); stmts.push(stmt); - stmts.push('DROP TEMPORARY TABLE IF EXISTS tmp.item'); stmt = new ParameterizedSQL( `CREATE TEMPORARY TABLE tmp.item @@ -65,13 +64,12 @@ module.exports = Self => { p.name AS producerName, nk.name AS inkName FROM item i - JOIN producer p ON p.id = i.producerFk - JOIN ink nk ON nk.id = i.inkFk - JOIN tmp.buyUltimate bu ON i.id = bu.itemFk + LEFT JOIN producer p ON p.id = i.producerFk + LEFT JOIN ink nk ON nk.id = i.inkFk + LEFT JOIN tmp.buyUltimate bu ON i.id = bu.itemFk AND bu.warehouseFk = ? `, [travel.warehouseInFk]); stmts.push(stmt); - stmt = new ParameterizedSQL('SELECT * FROM tmp.item'); stmt.merge(conn.makeSuffix(filter));