I need to make a query to get the last comment for each account. Each record has a timestamp I can use to find the last comment. The table is called tblActions, primary key is Action Id, the fields I need are AccountNo, DateOfAction, and Comments. The query I tried is
It gives me every record because of the Group By tblActions.Comments but I don’t know how to get around that and the primary key is comprised of a few different things so it is not exactly sequential.
Code:
SELECT tblActions.AccountNo, Max(tblActions.DateOfAction) AS MaxOfDateOfAction, tblActions.Comments
FROM tblActions
GROUP BY tblActions.AccountNo, tblActions.Comments;
It gives me every record because of the Group By tblActions.Comments but I don’t know how to get around that and the primary key is comprised of a few different things so it is not exactly sequential.