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 - HELP ?

Re: SQL - HELP ?

From: Sybrand Bakker <postbus_at_sybrandb.demon.nl>
Date: Wed, 25 Apr 2001 00:00:18 +0200
Message-ID: <hqtbetclg3eadjin5m11a92e52k3is9m0l@4ax.com>

On Tue, 24 Apr 2001 20:43:31 +0100, "Phil Paston" <p.paston_at_btinternet.com> wrote:

>Hi -
>I don`t know if this is the correct newsgroup appologies if it is not.
>
>I have a very large oracle table with 4 date columns in it date1 date2 date3
>and date4
>
>Is it possible in sql to write a single query that will give me : the max of
>date1 and date3 in a new column and the min of date3 and date4 in a sepatate
>column. or even better :- max of date1 and date3 - min of date3 and date4
>result in a single column. I don`t want to use a union query if I can help
>it as table is very large and i want to do the calc in one pass if at all
>possible.
>
>I am currently using a pl/sql fubction to do this but it is verry slow
>indeed and would like to solve the problem in sql is i can. I seem to recal
>that there is a sudo if that i might be able to use ??
>
>something like Decode(test the following is true or false date1 >
>date3,'YES',DATE1,DATE3)-Decode(test the following is true or false date2 <
>date4,'YES'DATE2,DATE4)AS DATECALC
>

Check out the greatest and the least function in your sql reference manual.

Hth,

>Any ideas would be appreciated
>Cheers
>Phil
>
>Ps if anyone would care to email me the answer as my newsgroup update takes
>several hours p.paston_at_btinternet.com
>
>

Sybrand Bakker, Oracle DBA Received on Tue Apr 24 2001 - 17:00:18 CDT

Original text of this message

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