sql - Grouping timestamps by day, not by time -
i've got table storing user access/view logs webservice run. tracks time timestamp though i'm finding when aggregate reporting care day, not time.
i'm running next query:
select user_logs.timestamp user_logs user_logs.timestamp >= %(timestamp_1)s , user_logs.timestamp <= %(timestamp_2)s order user_logs.timestamp
there other conditions shouldn't matter question. i'm using postgres i'd assume whatever feature used work in other languages.
i pull results python script counts number of views per date it'd create much more sense me if database grouping , count me.
how strip downwards it'll grouping day , ignore time?
select date_trunc('day', user_logs.timestamp) "day", count(*) views user_logs user_logs.timestamp >= %(timestamp_1)s , user_logs.timestamp <= %(timestamp_2)s grouping 1 order 1
sql postgresql
No comments:
Post a Comment