I want to only display a patient's record for their last visit.
When I execute this code:
SELECT mpl_id, Last_Name, First_Name, HP_Last_Visit
FROM Master_Patient_List m
WHERE HP_Last_Visit = (SELECT MAX(HP_Last_Visit) FROM Master_Patient_List l WHERE l.mpl_id = m.mpl_id )
I get these results (for one patient):
mpl_id Last_Name First_Name HP_Last_Visit
3195967 LNAME FNAME 2006-11-27
3238261 LNAME FNAME 2005-07-13
3238262 LNAME FNAME 2006-03-10
I need to only have the last visit displayed (in this case it's 3195967 record). Thanks!