Top Menu

Jump to content
Home
    • Projects
    • Activity
    • Work packages
    • Calendars
    • Team planners
    • Boards
    • News
    • Getting started
    • Introduction video
      Welcome to OpenProject Community
      Get a quick overview of project management and team collaboration with OpenProject. You can restart this video from the help menu.

    • Help and support
    • User guides
    • Videos
    • Shortcuts
    • Community forum
    • Enterprise support

    • Additional resources
    • Data privacy and security policy
    • Digital accessibility (DE)
    • OpenProject website
    • Security alerts / Newsletter
    • OpenProject blog
    • Release notes
    • Report a bug
    • Development roadmap
    • Add and edit translations
    • API documentation
  • Sign in
      Forgot your password?
      Create a new account

      or sign in with your existing account

      Google

Side Menu

  • Overview
  • Activity
    Activity
  • Roadmap
  • Work packages
    Work packages
  • Calendars
    Calendars
  • Team planners
    Team planners
  • Boards
    Boards
  • Forums
  • Feature tour
    Feature tour
You are here:
  • Forums
  • General discussion

Content

SQL report question - determine parent

Added by Mike McEldowney about 2 years ago

I'm trying to develop a report directly from the "openproject" Postgresql database for workpackages.  How should I determine the parent workpackage for a particular workpackage in SQL?


Replies (1)

RE: SQL report question - determine parent - Added by Oliver Günther about 2 years ago

Hi Mike,

The parent of a work package as all other relations are modeled through the relations table as a direct acyclic graph

To get the immediate parent, use this SQL:

SELECT * FROM relations WHERE to_id = <ID of the child> AND hierarchy = 1

Best

Oliver

  • (1 - 1/1)
Loading...