MySQL - strange return for select clause
문제
Why does the following clause does not return, for each userId, it's last connection date ?
I have 31 distinct userids in the table, each one with many dates...
select userid, date from connections group by userid having date = max(date)
해결책
Why are you adding the having
qualifier? If you want max date for each user's last connection try this:
select userid, max(date) from connections group by userid;
제휴하지 않습니다 StackOverflow