Latest Record per User
Medium
Duplicates & Deduplication
For every user return the most recent address and its update time. Order by user_id.
Table schema
AddressChanges(id INT PRIMARY KEY, user_id INT, address VARCHAR(20), updated_at DATE)Sample data
id | user_id | address | updated_at
1 | 1 | Pune | 2026-01-01
2 | 1 | Mumbai | 2026-03-01
3 | 2 | Delhi | 2026-02-01
4 | 2 | Agra | 2026-01-15
Discussion
No discussions yet.
Shalyam Support
Hi! Ask us anything — we'll reply on WhatsApp or Telegram within 24 hours.