Re: Date problem in SQL

From: Jurij Modic <jmodic_at_src.si>
Date: 1998/11/13
Message-ID: <364cb495.45507119_at_news.siol.net>#1/1


On Fri, 13 Nov 1998 20:40:42 +0100, bea_at_algonet.se (Bjorn E. Andersson) wrote:

>I have a table xxx with columns a, b, c, d
>where column d is date, including time in HH24MI format.
>
>How can I do a select with all records between
>last Friday 0000 and sysdate?

Use date functions TRUNC and NEXT_DATE and a simple date arithmetics:

SELECT a, b, c, d FROM my_table
WHERE d BETWEEN (TRUNC(NEXT_DAY(sysdate,'FRIDAY'))-7) AND sysdate;

Note that the name of the day must correspond to your NLS settings.

>
>Any ideas will be appriciated.

HTH, Jurij Modic <jmodic_at_src.si>
Certified Oracle7 DBA (OCP)



The above opinions are mine and do not represent any official standpoints of my employer Received on Fri Nov 13 1998 - 00:00:00 CET

Original text of this message