From: | Richard Broersma Jr <rabroersma(at)yahoo(dot)com> |
---|---|
To: | Vishal Kashyap <vishalonlist(at)gmail(dot)com> |
Cc: | Novice Postgresql-list <pgsql-novice(at)postgresql(dot)org> |
Subject: | Re: How to query for Interval |
Date: | 2006-04-11 21:16:55 |
Message-ID: | 20060411211655.827.qmail@web31812.mail.mud.yahoo.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
I had a similar question a while ago.
select count( timestmp ) as cnt, date_trunc('hour', timestmp) as hour
from process_table
where date_trunc('day', timestmp) between '2006-04-01' and '2006-04-11'
group by date_trunc('hour', timestmp);
I do not currently have access to postgresql to verify the syntax however. But this is the gist
of it.
Regards,
Richard Broersma Jr.
--- Vishal Kashyap <vishalonlist(at)gmail(dot)com> wrote:
> Hi,
>
>
> I have a table with time stamps in it . These timestamp represent a event count.
> I just wanted to know how could I query such that I get a count of
> event per hour.
>
> Table structure is
>
> my_table(id serial, time_event timestamp,event varchar(200));
>
> I want to do something like
> select count(id) from my_table where time_event in (every 1 hour);
>
> Any pointers / help would be appreciated
>
>
> --
> With Best Regards,
> Vishal Kashyap.
> http://www.vishal.net.in
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
> message can get through to the mailing list cleanly
>
From | Date | Subject | |
---|---|---|---|
Next Message | Richard Broersma Jr | 2006-04-11 21:26:24 | Re: How to query for Interval |
Previous Message | operationsengineer1 | 2006-04-11 21:01:08 | Re: advice on setting up schema sought |