Selecting latest row for user grouped by day help
One way (not necessarily the most efficient) is to use the Postgres special DISTINCT ON modifier in a subquery, and then sum:

SELECT
    SUM(score) AS score, 
    COUNT(*) AS count,
    created_at_date
FROM
  ( SELECT DISTINCT ON (user_id, created_at::date) 
        created_at::date AS created_at_date, 
        (DATA -&gt;&gt; 'score')::integer AS score
    FROM 
        scores
    ORDER BY 
        user_id, created_at::date, created_at DESC
  ) AS g
GROUP BY 
    created_at_date ;


Tested at SQLfiddle.