Span SQL Rows over time

63 views Asked by At

I have a table with this structure:

  • id: int
  • data: int
  • created_at: timestamp

But this table has approx. 1m rows and I cannot show this on a line graph, Is there a way to get certain rows that are distributed evenly across time? For example, say I only wanted 45 rows from the last 90 days, evenly distributed. I also must add that it is possible that I don't have data for the last 90 days. Therefore I would like to grab as much data as possible. Would it be more efficient to have a ranking system?

0

There are 0 answers