Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.tools -> Re: SQL -- select rows based on comparing 2 dates

Re: SQL -- select rows based on comparing 2 dates

From: <eastking_at_my-deja.com>
Date: Tue, 29 Aug 2000 03:39:16 GMT
Message-ID: <8ofb92$vhp$1@nnrp1.deja.com>

In article <8of0o0$jlf$1_at_nnrp1.deja.com>,   crunchy2k_at_my-deja.com wrote:
> I have a table with rows with these fields:
>
> Emplid
> Start Date (could be any date in the past)
> Termination Date (it's in the year 2000)
>
> I am using using SQL+, and I want to select rows only if the
> Termination Date is prior to the date in 2000 that corresponds to the
> Start Date. For example, if the Start Date is 8/1/1970 and the
> Termination Date is 7/1/2000, then select the row because 7/1/2000 is
> before 8/1/2000.
>
> Thanks.
>

 select * from your_table where to_char(TerminationDate,'YYYYMMDD') <= ('2000'||to_char(StartDate,'MMDD'))

Sent via Deja.com http://www.deja.com/
Before you buy. Received on Mon Aug 28 2000 - 22:39:16 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US