DISTINCT ON是您的朋友。
select distinct on (user_id) * from user_stats order by datestamp desc;
Postgres,table1左联接table2,table1中每个ID仅包含1行
DISTINCT ON是您的朋友。
select distinct on (user_id) * from user_stats order by datestamp desc;