Quality Center Query of Requirements table
Question ID: 104533
0
0

I would like to get a list of requirements under a parent requirements. I have the following SQL but this returns only the requirements directly under the parent requirement and it does not return any of the requirements that are children of the children.

Parent Requirement
Child1
child 1.1
child 1.2
child 1.2.1
child 1.2.2
child 1.3

Marked as spam
Posted by (Questions: 3, Answers: 1)
Asked on June 12, 2012 10:28 pm
56 views
Answers (1)
0
Private answer

The following query will give you almost what you want, if you supply the ID for the Requirement that is the parent.

with ReqCTE
as
(
SELECT
REQ.RQ_REQ_ID,
REQ.RQ_REQ_NAME,
REQ.RQ_FATHER_ID,
0 as lvl
FROM
td.REQ
where
REQ.RQ_REQ_ID = {?Father_ID}

union all

select
Folders.RQ_REQ_ID,
Folders.RQ_REQ_NAME,
Folders.RQ_FATHER_ID,
Child.lvl +1
from
ReqCTE as Child
join td.REQ as Folders on Folders.RQ_FATHER_ID = Child.RQ_REQ_ID
)
select * from ReqCTE

The output will look something like this

RQ_REQ_ID RQ_REQ_NAME RQ_FATHER_ID lvl
1309 Parent 1312 0
1310 Child 1 1309 1
1311 Child 1.1 1310 2
1314 Child 1.2 1310 2
1315 Child 1.1.3 1311 3

Marked as spam
Posted by (Questions: 1, Answers: 101)
Answered on August 23, 2012 6:59 pm
EyeOnTesting

Welcome back to "EyeOnTesting" brought to you by Orasi Software, Inc.

X
Scroll to Top