根据 JOIN 结果更新行

Update Rows based on JOIN results

我无法使以下查询工作:

UPDATE ISSUE
SET DUE_DATE = DATE(ISSUE.DATE_ADDED,'+90 day')
JOIN CVE on CVE.CVE_ID = ISSUE.CVE_ID
WHERE CVE.CVSS >= 4 AND CVE.CVSS < 9

这是因为在 sqlite3 you can't join in an UPDATE. What I'm trying to do is set the due date of an issue to be 90 days after the date added if the CVE 中与此问题相关的是:greater than or equal to four and less than 9. 是否有我在这里遗漏的替代选项?

您可以在子查询中加入行。

UPDATE ISSUE
SET DUE_DATE = DATE(ISSUE.DATE_ADDED,'+90 day')
WHERE ISSUE.CVE_ID IN (
  SELECT ISSUE.CVE_ID
  FROM ISSUE JOIN CVE on CVE.CVE_ID = ISSUE.CVE_ID
  WHERE CVE.CVSS >= 4 AND CVE.CVSS < 9
)