我想計算按項目重新打開的票的平均數量,但我無法通過單個SQL請求來完成此操作。 我已經取回車票的總數:如何使用兩個SQL請求(mysql)計算平均數
select count(jiraissue.id) as totalTicketByProj
from jiraissue ,project
where jiraissue.project=project.id
group by project.pname;
而且我已經retrived號重新開放門票:
select count(changeitem.id) as nbissueReopenByProject
from changeitem,changegroup,jiraissue,project
where changeitem.groupid=changegroup.id
and changegroup.issueid=jiraissue.id
and jiraissue.project= project.id
and changeitem.oldstring="Resolved"
and changeitem.newstring="Closed"
group by project.pname;
但我不知道如何計算重新門票的平均數量(nbissueReopenByProject/totalTicketByProj)使用單個請求!
任何想法!
感謝你的回覆也是非常有用 – Rym 2011-06-06 10:02:00