我正在尝试在dv.severity列名称的单独列中添加计数功能。该列包括严重性的输出:中度和严重。以下是我当前的查询。
SELECT ds.name AS site, date_published, dv.severity, dv.title AS vulnerability_title
FROM fact_asset_vulnerability_finding favf, dv.severity
JOIN dim_asset da USING (asset_id)
JOIN dim_operating_system dos USING (operating_system_id)
JOIN dim_vulnerability dv USING (vulnerability_id)
JOIN dim_site_asset dsa USING (asset_id)
JOIN dim_site ds USING (site_id)
WHERE now() - date_published < INTERVAL '180 days'
ORDER BY dv.title ASC
以下是我的输出中的摘录
+ --------+----------------+----------+-----------------------------------------------------------------+ | site | date_published | severity | vulnarability_title | + --------+----------------+----------+-----------------------------------------------------------------+ | MEAS-de | 1/30/2018 | Severe | 7-Zip: CVE-2017-17969: Heap based buffer overflow vulnarability | + --------+----------------+----------+-----------------------------------------------------------------+
现在的结果:4列;网站,发布日期,严重性,漏洞标题
结果我想要5列;网站,发布日期,严重性,严重性计数,漏洞标题
答案 0 :(得分:0)
建议:以下是我的输出中的摘录
立即获得结果: 4列;网站,发布日期,严重性,漏洞标题
我想要的结果 5列网站,发布日期,严重性,严重性计数,漏洞标题
答案 1 :(得分:0)
FROM fact_asset_vulnerability_finding favf,dv.severity ---不是错字。
答案 2 :(得分:0)
我计算出计数。我需要添加以下内容:count(dv.severity)和GROUP BY网站,date_published,严重性,脆弱性标题。这使我能够拥有计数功能。