NMiller007
Programmer
I am trying to pull the minimum of two fields and then add up two other fields from the minimum record in the table. Here is the SQL:
If I group by PreviousBal, then the query will execute, but then I get every record for that loan, not just the record with the minimum dates.
Can I do this without using a preliminary query to get the mins and then another query to pull the PreviousBal?
Code:
SELECT db_history.loan_id, Min(db_history.due_dt) AS MinOfdue_dt, Min(db_history.paid_dt) AS MinOfpaid_dt, [prin_amt]+[prin_bal_amt] AS PreviousBal
FROM db_history
GROUP BY db_history.loan_id;
If I group by PreviousBal, then the query will execute, but then I get every record for that loan, not just the record with the minimum dates.
Can I do this without using a preliminary query to get the mins and then another query to pull the PreviousBal?