From: | "tjk(at)tksoft(dot)com" <tjk(at)tksoft(dot)com> |
---|---|
To: | frank(at)x9media(dot)com (Frank Joerdens) |
Cc: | pgsql-sql(at)postgreSQL(dot)org |
Subject: | Re: [SQL] datetime query issue |
Date: | 1999-08-28 18:23:51 |
Message-ID: | 199908281823.LAA22218@uno.tksoft.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Frank,
Use the date_part function to extract the hour and then
find the records which match.
E.g. select id,date_part('hour', mydate) from table1 where date_part('hour', mydate) >= 6 and date_part('hour', mydate) <= 22;
Troy
>
> 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
>
>
> ************
>
>
From | Date | Subject | |
---|---|---|---|
Next Message | Frank Joerdens | 1999-08-28 18:41:49 | Re: [SQL] datetime query issue |
Previous Message | Frank Joerdens | 1999-08-28 13:35:07 | datetime query issue |