Re: [SQL] datetime query issue

From: Frank Joerdens <frank(at)x9media(dot)com>
To: pgsql-sql(at)postgreSQL(dot)org
Subject: Re: [SQL] datetime query issue
Date: 1999-08-28 18:41:49
Message-ID: 19990828204148.B18896@shark.x9media.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

um, this was probably unintelligible. this is the table:

+----------------------------------+----------------------------------+-------+
| Field | Type | Length|
+----------------------------------+----------------------------------+-------+
| source_numeric | int8 not null | 8 |
| destination_numeric | int8 not null | 8 |
| source | text not null | var |
| destination | text not null | var |
| bytes | int8 not null | 8 |
| date | datetime | 8 |
+----------------------------------+----------------------------------+-------+

every hour, a set of rows is added to this table with the current timestamp on
each row. i guess i need a function to extract the time from datetime. date_trunc
may be what i am looking for but i couldn't find information in the documentation
as to how to use these functions.

On Sat, Aug 28, 1999 at 03:35:07PM +0200, Frank Joerdens wrote:
> I'm not sure how to go about this: I want to find all rows with a timestamp
> between, say 6 a.m. and 10 p.m. for any number of days. The column format is
> datetime. How do I extract the 'time of the day' information from this
> column? What I can think of is to create a view for every single day where datetime
> is > 6 and < 10 and then another query on all views together but that doesn't sound
> very elegant and would be a real memory hog for a large number of days.
>
> Any better ideas?
>
> Thanks
>
> Frank
>
>
> ************

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Dipl.-Ing. Thomas Schallar 1999-08-29 00:24:18 SELECT multiple tables with same fields
Previous Message tjk@tksoft.com 1999-08-28 18:23:51 Re: [SQL] datetime query issue