posts(post_id, user_id, posted_at)
For users who posted at least twice during 2026, return user_id and
posting_span_days: the number of whole days between their first and last post
that year.
Users with exactly one post in 2026 are excluded, not reported as zero. A user whose two posts fall on the same day has a span of 0 and does count.
Tables
posts
post_id user_id posted_at
------- ------- -------------------
1 1 2026-01-10 08:00:00
2 1 2026-03-02 09:00:00
3 2 2026-05-05 10:00:00
4 3 2026-07-01 08:00:00
5 3 2026-07-01 20:00:00
6 4 2025-12-31 23:00:00
7 4 2026-02-01 00:00:00
Expected result
user_id posting_span_days
------- -----------------
1 51
3 0
Sign in to write and run your own code.
SELECT query