Query to determine if project is a master project or sub project

Document ID : KB000055132
Last Modified Date : 14/02/2018
Show Technical Document Details

Description:  
We are trying to build an NSQL Query to be used in a portlet. Can you help us with a query to determine if project is a master project or sub project?

Solution:   

Here are 2 example queries.  Reference the Technical Reference Guide for more details on database table schema.


Run this query to determine the Master/Subprojects 

SELECT
master.name master_project,
subproject.name subproject
FROM
srm_projects master,
prtask t,
prsubproject s,
srm_projects subproject
WHERE
master.is_program = 0 and
t.prprojectid = master.id and
t.prid = s.prtaskid and
s.prrefprojectid = subproject.id


Run this query to determine the Program/Subprojects

SELECT
program.name program,
subproject.name subproject
FROM
srm_projects program,
prtask t,
prsubproject s,
srm_projects subproject
WHERE
program.is_program = 1 and
t.prprojectid = program.id and
t.prid = s.prtaskid and
s.prrefprojectid = subproject.id