J
jpark3205
I am trying to select the most recent loan store from a group of data for
each individual person. It is close to the last step in perfecting my query,
but it is one of the most important parts because I have the report grouped
by Loan Store so it needs to be correct. For example,
PS loan store Date Amt
100 20 7/20/08 10
100 1 8/19/08 20
In my query I have it grouped by PS and Sum of Amount... However, I need the
most recent loan store to be brought in as well. I have tried using the last
option in design view, but it is always taking the largest number. (i.e. 20
in this case). I need it to select 1. Here is my SQL statement if it will
help.
SELECT Advances.PS, Last(Advances.Partner_Name) AS LastOfPartner_Name,
Max(Advances.Date) AS MaxOfDate, Max(Advances.[Payout Store]) AS [MaxOfPayout
Store], Sum(Advances.Amount) AS SumOfAmount, Termed.[Term Date],
Count(Advances.Description) AS CountOfDescription, [Chargeback log].[Date
Charged Back]
FROM (Advances LEFT JOIN Termed ON Advances.PS = Termed.ID) LEFT JOIN
[Chargeback log] ON Advances.PS = [Chargeback log].PS
GROUP BY Advances.PS, Termed.[Term Date], [Chargeback log].[Date Charged
Back];
Thank you sooo much for your help!
each individual person. It is close to the last step in perfecting my query,
but it is one of the most important parts because I have the report grouped
by Loan Store so it needs to be correct. For example,
PS loan store Date Amt
100 20 7/20/08 10
100 1 8/19/08 20
In my query I have it grouped by PS and Sum of Amount... However, I need the
most recent loan store to be brought in as well. I have tried using the last
option in design view, but it is always taking the largest number. (i.e. 20
in this case). I need it to select 1. Here is my SQL statement if it will
help.
SELECT Advances.PS, Last(Advances.Partner_Name) AS LastOfPartner_Name,
Max(Advances.Date) AS MaxOfDate, Max(Advances.[Payout Store]) AS [MaxOfPayout
Store], Sum(Advances.Amount) AS SumOfAmount, Termed.[Term Date],
Count(Advances.Description) AS CountOfDescription, [Chargeback log].[Date
Charged Back]
FROM (Advances LEFT JOIN Termed ON Advances.PS = Termed.ID) LEFT JOIN
[Chargeback log] ON Advances.PS = [Chargeback log].PS
GROUP BY Advances.PS, Termed.[Term Date], [Chargeback log].[Date Charged
Back];
Thank you sooo much for your help!