我有两张table,虫子和虫子历史。以下数据分别对应于它们的模式:
漏洞:
**BugId Priority Severity PlatformFound GameArea TestType**
-----------------------------------------------------------
23 0 - QA - Before Beta Common Ad Hoc Testing
46 0 - QA - Before Beta Common Ad Hoc Testing
69 0 - QA - Before Beta C Common Art Ad Hoc Testing
92 0 - QA - Before Beta B Common Audio Ad Hoc Testing
138 1 - Dev - Medium Playstation 4 Ad Hoc Testing
184 0 - QA - Before Beta A Common Game Modes Ad Hoc Testing
207 0 - QA - Before Beta C Common Art Ad Hoc Testing
230 0 - QA - Before Beta C Common Art Ad Hoc Testing
253 0 - QA - Before Beta Common Ad Hoc Testing
276 0 - QA - Before Beta C Common Art Ad Hoc Testing
299 0 - QA - Before Beta C Playstation 4 Game Modes Ad Hoc Testing
322 0 - QA - Before Beta C Common Game Modes Ad Hoc Testing
345 0 - QA - Before Beta NULL Common NULL Ad Hoc Testing
368 0 - QA - Before Beta C Common Art Ad Hoc Testing
391 0 - QA - Before Beta Common Free Testing
414 0 - QA - Before Beta C Common Game Modes Free Testing
437 0 - QA - Before Beta C Common Art Ad Hoc Testing
460 0 - QA - Before Beta C Common Game Modes Ad Hoc Testing
483 0 - QA - Before Beta C Common Art Ad Hoc Testing
错误历史:
BugId FullDate ProgressStatus
23 2016-11-29 Submitted
23 2016-11-30 Submitted
23 2016-12-01 Submitted
23 2016-12-02 Submitted
23 2016-12-03 Submitted
23 2016-12-04 Submitted
46 2017-07-17 Closed - Fixed
46 2017-07-18 Closed - Fixed
46 2017-07-19 Closed - Fixed
46 2017-07-20 Closed - Fixed
46 2017-07-21 Closed - Fixed
46 2017-07-22 Closed - Fixed
46 2017-07-23 Closed - Fixed
69 2016-11-29 Submitted
69 2016-11-30 Submitted
69 2016-12-01 Submitted
69 2016-12-02 Submitted
我需要创建一个sql查询来合并来自“bughistory”和“bugs”的数据,这样我就可以得到每个“fulldate”的严重性-a bug的计数。结果中只包含计数超过7个错误的天数。
我的问题是:
SELECT count(bugs.BugID), bughistory.fullDate severity_A FROM 'Bugs' bugs
INNER JOIN 'BugHistory' bughistory ON bugs.BugID = bughistory.BugId where bugs.Severity = 'A'
GROUP BY(bughistory.FullDate) Having count(bugs.BugID) > 7;
1条答案
按热度按时间fcg9iug31#
我们可以
INNER JOIN
在两张table之间使用BugId
以及Severity = 'A'
. 那我们就可以了GROUP BY
在FullDate
以及Count(Distinct ..)
可用于计算特定日期的唯一错误。最终,
HAVING
子句将只考虑那些错误大于或等于7的日期。