I am working on a SQL query to extract the projects their leads and the project category. I was able to extract this with the below query
select pc.id,pc.cname, p.id, p.pname from nodeassociation na, projectcategory pc, project p
where na.sink_node_id=pc.id and
na.source_node_id=p.id and
na.sink_node_entity='ProjectCategory' and
na.association_type='ProjectCategory'
order by pc.cname;
OR
select p.id, p.pname, p.lead, na.sink_node_id, na.sink_node_entity, pc.cname from jiradb.jiraschema.project p
left outer join jiradb.jiraschema.nodeassociation na ON na.source_node_id=p.id
Inner join jiradb.jiraschema.projectcategory pc ON na.sink_node_id=pc.id
WHERE
na.sink_node_entity='ProjectCategory' and
na.association_type='ProjectCategory'
but there is a glitch in this. I have some projects which does not have any category my query doesn't extract those projects. I have looked into node association and there is no entry for that project for project category even with value null. It seems kind of not possible to me. If anyone is having a clue of how to do it. Please let me know.
Hello,
Use outer join the get the lines with null values. It would be something like this
select p.id, p.pname, p.lead, na.sink_node_id, na.sink_node_entity, pc.cname from jiradb.jiraschema.project p
left outer join jiradb.jiraschema.nodeassociation na ON na.source_node_id=p.id
left outer join jiradb.jiraschema.projectcategory pc ON na.sink_node_id=pc.id
WHERE
na.sink_node_entity='ProjectCategory' and
na.association_type='ProjectCategory'
Hey Alexey,
Thank you for response. Even with above query I am getting the exact same result as I was getting with my query, It does not retrieve the project with no category.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
this is nice but is there any option to achieve below type of list
Project Key
Project Description
Project Lead
Project Lead Email
Project Category
Project URL
Project Create Date
Project Name
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.