Skip to content Skip to sidebar Skip to footer

Find Earliest Created Record From Each Day

I am trying to find the earliest created_at record by day in a Redshift database: Ideally this would return the 1st and 3rd record. I am very new to SQL, so I apologize for my idi

Solution 1:

try this

select date_trunc('day', created_at), min(created_at)
fromtablegroupby date_trunc('day', created_at)

Solution 2:

Did you try doing something like

SELECT MIN(created_at) FROM day GROUP BY created_at::date

See getting date from timestamp in PostgresSQL

Post a Comment for "Find Earliest Created Record From Each Day"