Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.tools -> SQL - HELP ?
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
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 Received on Tue Apr 24 2001 - 14:43:31 CDT