0

私はここでmvc3で働いています。助けが必要です

ここに(BugId)のようなテーブルがいくつかあります

BugID タイトル 説明 ProjectId Version BuildNumber EmployeeId CategoryID CreatedDate SeverityID PriorityID ReleasePhaseID TypeID

2 銀行 Bankingapplication 1 新しいバージョン 新しいビルド番号 1 1 00:00:00.00 1 1 1 1

(プロジェクト表)

================================================== =====

 Projectid  ProjectName Description        Status

1   Finance     This is Finance Project    Active
2   Uniformatic This is Finance Project    Active
3   ProDuct     This is Finance Project    InActive
4   Cloud       This is Finance Project    INActive
5   Banking     This is Finance Project    Progress

6 ecommerce これは Finance Project Active です

RealesePhase (テーブル)

================================================== ==================

 ReleasePhaseID    ReleasePhase

1       DEV
2       QA
3       Alpha
4       Beta

5 ライブ

Tostatus(テーブル)

================================================== =

ToStatusId        Tostatus

1       New
2       Assigned
3       Fixed
4       Re-Opened
5       Closed
6       Deffered

7 バグではない

バグヒストリー(表)

BugHistoryID BugID FixedByID AssignedTo 解決 FromStatus ToStatus

5                  2         1            1     this is my banking     New           New
7                  2         1            1     this assignto res                km,l

================================================== ================================================== ==

ここにこれらのテーブルがあり、そこから ProjectName(dropdown) And (ReleasePhase) を選択するクエリを作成する必要があります (open)(closed)(fixedBy)

Bugs テーブルでは Bugs がそこからログ (挿入) されるので、プロジェクト名を選択する場合はドロップダウンとして Project Name & ReleasePhase を選択する必要があります。

from it like (view) should like this

================================================== ===================

ProjectName RealesePhase openBugs ClosedBugs fixedBy

                 1         New         EmployeName
                 2         Assigned    EmployeName
                 3         Fixed       EmployeName
                 4         Re-Opened   EmployeName

================================================== ====================

クエリ数を書いて、従業員が挿入したバグの数とリリースされたバグの数とクローズされたバグの数を表示するのを手伝ってください

前もって感謝します

4

1 に答える 1

1

これにはストアドプロシージャを使用することをお勧めします..ステータステーブルとReleasephaseとProjectIdに従ってバグの数が必要だと思います..

 Create procedure [dbo].[ProjectReports]
 (
 @ProjectID int,
 @ReleasePhaseID int
 )
 as
 begin
 select distinct projectName,ReleasePhase,
(Select  COUNT(1) from Bugs where ProjectId=a.ProjectId and ReleasePhaseID=a.ReleasePhaseID and
bugid in (select BugID from BugHistory where [status]='New')) as Newbugs,
(Select  COUNT(1) from Bugs where ProjectId=a.ProjectId and  ReleasePhaseID=a.ReleasePhaseID and 
bugid in (select BugID from BugHistory where [status]='Assigned')) as Assignedbugs,
(Select  COUNT(1) from Bugs where ProjectId=a.ProjectId and ReleasePhaseID=a.ReleasePhaseID and
bugid in (select BugID from BugHistory where [status]='Fixed')) as Fixedbugs,
(Select  COUNT(1) from Bugs where ProjectId=a.ProjectId and ReleasePhaseID=a.ReleasePhaseID and
bugid in (select BugID from BugHistory where [status]='Re-Opened')) as Reopenedbugs,
(Select  COUNT(1) from Bugs where ProjectId=a.ProjectId and ReleasePhaseID=a.ReleasePhaseID and
bugid in (select BugID from BugHistory where [status]='Closed')) as Closedbugs,
(Select  COUNT(1) from Bugs where ProjectId=a.ProjectId and ReleasePhaseID=a.ReleasePhaseID  and
 bugid in (select BugID from BugHistory where [status]='Deffered')) as Defferedbugs,
(Select  COUNT(1) from Bugs where ProjectId=a.ProjectId and ReleasePhaseID=a.ReleasePhaseID and
 bugid in (select BugID from BugHistory where [status]='Not a Bug')) as NotaBug
 from Bugs a
inner join Projects p on p.ProjectId=a.ProjectId
 inner join ReleasePhase Rp on rp.ReleasePhaseID=a.ReleasePhaseID
where a.ProjectId=@ProjectID and a.ReleasePhaseID=@ReleasePhaseID
end
于 2012-08-31T10:36:19.993 に答える