I have a table that stores the hierarchy of workgroups in our organization. It looks something like:

```
CREATE TABLE WORKGROUPS  ( 
    WORKGROUPID         NUMBER NULL,
    NAME                VARCHAR2(100) NOT NULL,
    PARENTWORKGROUPID   NUMBER NOT NULL,
    WORKGROUPLEVEL      CHAR(1) DEFAULT 1 NOT NULL,
    CONSTRAINT WORKGROUPS_PK PRIMARY KEY(WORKGROUPID)
)

```

For example, there might be three levels of workgroups deep:

```
ID 1 - Sales (PARENTWORKGROUPID = 0)
ID 2 - Business Sales (PARENTWORKGROUPID = 1)
ID 3 - West Coast B2B (PARENTWORKGROUPID = 2)

```

So 3's parent is 2, 2's parent is 1, and 1 is a top level workgroup with no parent, so we use 0.

Now we have a TASKS table. Each TASKS row has a WORKGROUPID column that points to a WORKGROUPID in the WORKGROUPS table.

I need to write a query that returns all TASKS that are under a given top-level workgroup, such as everything under Sales (which, in the example above, could be WORKGROUPIDs 1, 2 or 3. Basically, it's a recursive query.

I can think of some ways to do this using a LEFT JOIN for to check each level, but I'd rather stay away from solutions that hard-code in the number of levels since the database is designed to allow any number of tiers. Any other solution I can think of involves changing the table schema, which I can't do at the moment. Any ideas? Thanks!