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

Home -> Community -> Usenet -> c.d.o.server -> Re: Returning The Closest Single Value

Re: Returning The Closest Single Value

From: Barry Warner <bwarner_at_blueyonder.co.uk>
Date: Thu, 17 Oct 2002 09:56:48 +0100
Message-ID: <3Xur9.29991$jR.25862@news-binary.blueyonder.co.uk>


Thanks for the help

Niall Litchfield <n-litchfield_at_audit-commission.gov.uk> wrote in message news:3dae7508$0$8514$ed9e5944_at_reading.news.pipex.net...
> "Niall Litchfield" <n-litchfield_at_audit-commission.gov.uk> wrote in message
> news:3dae73fb$0$8507$ed9e5944_at_reading.news.pipex.net...
> > "Barry Warner" <bwarner_at_blueyonder.co.uk> wrote in message
> > news:K3ur9.29254$jR.14136_at_news-binary.blueyonder.co.uk...
> > > Hi
> > >
> > > I need to compare the system date with the first available date in
> > > workshop_start_date column. How do I only return the closest date?
> >
> > select min(abs(sysdate-workshop_start_date)) from .... where....;
> >
> > HTH
>
> but of course that doesn't help much as it only gives the interval not the
> closest date.
>
> select workshop_start_date from ....
> where abs(sysdate-workshop_start_date) =
> min(abs(sysdate-workshop_start_date))
>
> might work rather better,NB all those functions might slow down
performance
> somewhat on a very large table.
>
>
> --
> Niall Litchfield
> Oracle DBA
> Audit Commission UK
> *****************************************
> Please include version and platform
> and SQL where applicable
> It makes life easier and increases the
> likelihood of a good answer
>
> ******************************************
>
>
Received on Thu Oct 17 2002 - 03:56:48 CDT

Original text of this message

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