Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: sql query on substract
8.1.6 and above:
1 Select datex, s_sum, nvl(s_sum-a,0) from 2 (Select to_char(s_month,'MON') datex,
3 s_sum, 4 lag(s_sum,1) over (order by s_month) A, 5 lead(s_sum,1) over (order by s_month) B6* from jonny99) x
JAN 1000 0 FEB 1200 200 MAR 1250 50
I left the lead operator in there so you could take the SQL from the in-line, play with it, and see how it works. Of course, remove s_sum from the main query to get the exact output you desire.
Regards,
Larry G. Elkins
elkinsl_at_flash.net
214.954.1781
-----Original Message-----
From: root_at_fatcity.com [mailto:root_at_fatcity.com]On Behalf Of Jonny Delmont
Sent: Friday, July 26, 2002 4:43 AM
To: Multiple recipients of list ORACLE-L
Subject: sql query on substract
How to substract my s_sum column in sql statement ?
S_MONTH S_SUM
S_MONTH S_SUM
Thanks,
Jonny
http://uk.docs.yahoo.com/mail_storage.html
--
Please see the official ORACLE-L FAQ: http://www.orafaq.com
--
Author: Larry Elkins
INET: elkinsl_at_flash.net
Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051 San Diego, California -- Public Internet access / Mailing Liststo: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). Received on Fri Jul 26 2002 - 06:08:22 CDT
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message