문제

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;
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top