Find the details (patient_id, admission_id, admission_date, diagnosis) of the most recent admission for each patient. If a patient has multiple admissions on their most recent admission date, select only the single latest admission record (the one with the highest admission_id). Sort the final result by patient_id in ascending order.
Expected Output
Query Editor
User Output Ready
Execute a query or press Ctrl+Enter to view results...
Databases & Questions
Hint
Several approaches work: a correlated subquery, a window function, a join to a grouped result, or a PostgreSQL-specific clause.