I have a hierarchy (temp table) built for all parent/child type items with range keys. I have a table (LastOrdr) that has the last order date for all items (regardless parent/child). Then I have the master item table with all items. 

I have a query that selects all non parent/child items that meet a certain lastorderdate criteria. It's a simple query that joins master item table with the LastOrdr table to get the max(lastorderdate) from a supplied user parameter.

My challenge is to do the same for the parent/child products. For parent/child items (one parent and could have up to 8 child but 2/3 in most cases). The selection is, for a family, the max(lastorderdate) has to be applied to the whole family. What I mean is, if I have 3 child for a parent, I need to find the max of all 4 (1 parent and 3 child) items in this family from LastOrdr.lastorderdate, then compare it to the user supplied parameter. if it meets the criteria as a family, I want to select that family, otherwise, discard it.

Some guidance to achieve this would be greatly appreciated.

Thanks.

Table1 (master item):

```
itemID    ParentID    Descrip    ......
21         2           .....
22         2           .....
23         2           .....
24         2           .....
27         3           .....
29         3           .....
33         3           .....
41         3           .....
......................

```

Table2 (LastOrdr):

```
ItemID    lastorderdate
2          2014-01-01
21         2014-07-21
21         2015-01-12
22         2013-01-01
23         2014-04-01
27         2013-01-23
...........................

```