Thanks for your work!
The query is close but still not exactly right.
A question: When you specify 'First', 'Last', 'Max', etc. in a query, will the result be limited to a single row? I.e. if the rows are different will the query return the first, last, max value no matter which row it is in, or will the values all be picked from a single row? If not, would it return data from the first, last, max rows? In this case we need an entire row.
If you look at the sample queries you worked on, Budget id 4 is correct, but budget id 6 needs to return the data in the single row with mod-id 93 ($1372.54); budget id 8 should return the row with mod id 91 (amount is wrong), etc. What has to happen is the query needs to return the entire row for the last mod-id of each budget id.
I made it work by sortiing Q1 by budget-id/mod-id and selecting Last in Q2 sumofamount. I also sorted Q2 by mod end date, but I don't think it is necessary because it works both ways.
Thanks again for your help...I couldn't have done this without it!
John