I have two tables:
members (
userid int primary key
)
login_history (
userid int,
login datetime
)
An entry to login_history table is made every time a user logs in.
I'm trying to write a query to find every users last login time. ie. The MAX(login) or return null if the user has no login history. What's the best SQL to accomplish this? thanks