Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.tools -> Re: SQL -- select rows based on comparing 2 dates
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
![]() |
![]() |