search cancel

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

book

Article ID: 55132

calendar_today

Updated On:

Products

Clarity PPM SaaS Clarity PPM On Premise

Issue/Introduction

Trying to build an NSQL Query to be used in a portlet, and need help with a query to determine if project is a master project or sub project?

Resolution

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