Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: Substraction SQL query
i/p data
s_sum timestamp
2150 7/26/02 1:13:47 AM 2162 7/26/02 1:15:01 AM 2170 7/26/02 1:16:27 AM 2200 7/26/02 1:20:34 AM
Solution :
select a.s_sum - b.s_sum s_sum,a.timestamp
from x_test a,x_test b
where (a.s_sum > b.s_sum)
and b.s_sum =
(
select max(s_sum)
from x_test
where s_sum < a.s_sum
)
or rownum = 1
o/p data :
s_sum timestamp
0 7/26/02 1:13:47 AM 12 7/26/02 1:15:01 AM 8 7/26/02 1:16:27 AM 30 7/26/02 1:20:34 AM -----Original Message----- From: jonny99delmont [mailto:jonny99delmont_at_yahoo.co.uk] Sent: Friday, July 26, 2002 7:13 PM To: ORACLE-L Cc: jonny99delmont
<< File: Substraction SQL query.HTM >>
-- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: INET: cosltemp-g.manoj_at_orbitech.co.in Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051 San Diego, California -- Public Internet access / Mailing Lists -------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-LReceived on Mon Jul 29 2002 - 01:38:26 CDT
(or the name of mailing list you want to be removed from). You may
also send the HELP command for other information (like subscribing).