how can i join data aggregated by day on a primary table?

If you version of SQL support analytic functions, then use COUNT here:

SELECT date, id, COUNT(id) OVER (PARTITION BY date) total_id_per_day
FROM yourTable
ORDER BY date;

If you are stuck without analytic functions, then use a join to a subquery which finds the counts:

SELECT,, t2.cnt AS total_id_per_day
FROM yourTable t1
    SELECT date, COUNT(id) AS cnt
    FROM yourTable
    GROUP BY date
) t2
    ON =

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top