I’m trying to design a query that returns the most recent date for a given criteria. I’ve tried using the Max variable in the Group by section in the query, but that does not work. I think I might need to use the DMax function, but I’m not sure on the proper syntax for the query I’m trying to run.
There are two tables, “PatientsInfo” and “NutritionInfo”. They are linked by PatientID(one-to-many). I’m trying to return the Lastname, Firstname (from the “PatientsInfo” table), and the most recent DateNutr, and VitDlevel, where VitDlevel is >0 and <20.1. DateNutr and VitDlevel are from the “NutritionInfo” table.
Expected outcome would look something like:
Doe|John|6/12/18|14.5
Smith|Jane|3/7/18|18.0
But I’m getting:
Doe|John|6/12/18|17.0
Doe|John|2/14/18|14.5
Smith|Jane|3/7/18|18.0
Smith|Jane|12/17/17|18.0
Smith|Jane|3/14/17|12.6
Any thoughts or suggestions?
Thank you!