Top Menu

Jump to content
Home
    Modules
      • Projects
      • Activity
      • Work packages
      • Gantt charts
      • 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
    • Upgrade to Enterprise edition
    • 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?

      or sign in with your existing account

      Google

Side Menu

  • Overview
  • Activity
    Activity
  • Roadmap
  • Work packages
    Work packages
  • Gantt charts
    Gantt charts
  • Calendars
    Calendars
  • Team planners
    Team planners
  • Boards
    Boards
  • News
  • Forums

Content

General discussion
  1. OpenProject
  2. Forums
  3. General discussion
  4. SQL report question - determine parent

SQL report question - determine parent

Added by Mike McEldowney almost 4 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 almost 4 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...