• @JeeTree

    Thanks for the info and for the links.

    @sean Lange

    The output in the sample it's the content of the @Third table.

    I'll try to put the problem in another perspective.

    Assuming that prj = worker and typ = work order

    So the first table lets say that's the amount of hours already used by one worker in each work order type.

    The second table it's like the kind of schedule of work orders that some worker must do, so for the same kind of work i can have several wos, and each one has a start date and a due date.

    What i need to get it's the work orders that still have hours to use, so i need to run through every wos, the work orders are order by date to use the old ones first, and subtract the amount of hours that the worker already used...

    Thanks