From f7389e6e0b3d3628050e11c774eef8b1050437cd Mon Sep 17 00:00:00 2001 From: Eric Date: Wed, 3 Jul 2024 13:34:59 -0500 Subject: [PATCH] Update query --- ee/vulnerability-dashboard/scripts/update-reports.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/ee/vulnerability-dashboard/scripts/update-reports.js b/ee/vulnerability-dashboard/scripts/update-reports.js index 00ecaa23c269..4bea434f4b2d 100644 --- a/ee/vulnerability-dashboard/scripts/update-reports.js +++ b/ee/vulnerability-dashboard/scripts/update-reports.js @@ -906,12 +906,10 @@ module.exports = { // Check for Vulnerabilities that have no associated Host or VulnerabilityInstall records. let nativeQueryToFindVulnsWithNoAssociatedRecords = - `SELECT id - FROM vulnerability - WHERE id NOT IN ( - SELECT vulnerability - FROM vulnerabilityinstall - );`; + `SELECT v.id + FROM vulnerability v + LEFT JOIN vulnerabilityinstall vi ON v.id = vi.vulnerability + WHERE vi.vulnerability IS NULL;`; let rawResultFromDatabase = await sails.sendNativeQuery(nativeQueryToFindVulnsWithNoAssociatedRecords); let vulnerabilityRecordIdsWithNoAssociatedRecords = rawResultFromDatabase.rows;