Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: SQL Query
This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.
------_=_NextPart_001_01BFDE73.522AC880
Content-Type: text/plain;
charset="windows-1255"
Hi Pallav,
Here are two possibilities to reach the rows you want, You probably have a a logical rule to put in the WHERE close according to date or value.
select A.Date as OLD_DATE, A.Value as Val, B.Date as New_DATE, B.Value as
New_VAl
from ABC A, ABC B
WHERE A.Date < B.Date
and A.Value = B.Value -4
select A.Date as OLD_DATE, A.Value as Val, B.Date as New_DATE, B.Value as
New_VAl
from ABC A, ABC B
WHERE A.Value = B.Value -4
Hope this helps,
Ruth Fouks
Tvuna Software Industries LTD.
Petah - Tikva ISREAL
972-3-9242652/308
-----Original Message-----
From: Pallav Kalva [mailto:pallav_at_starmedia.net]
Sent: Saturday, June 24, 2000 4:04 AM
To: Multiple recipients of list ORACLE-L
Subject: SQL Query
Hi Guys,
I have a table ABC with 2 columns like
Date Values ---- ------ 22-JUN-00 1 22-JUN-00 2
.
.
23-JUN-00 5 23-JUN-00 6 I want the result to be
OLD_DATE VAL NEW_DATE VAL -------- --- -------- --- 22-JUN-00 1 23-JUN-00 5 22-JUN-00 2 23-JUN-00 6
Is there any simpler way to do that ???
Thanks!
Pallav
-- Author: Pallav Kalva INET: pallav_at_starmedia.net 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-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). ------_=_NextPart_001_01BFDE73.522AC880 Content-Type: text/html; charset="windows-1255" Content-Transfer-Encoding: quoted-printable <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> <HTML> <HEAD> <META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; = charset=3Dwindows-1255"> <META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version = 5.5.2232.0"> <TITLE>RE: SQL Query</TITLE> </HEAD> <BODY> <P><FONT SIZE=3D2>Hi Pallav,</FONT> </P> <P><FONT SIZE=3D2>Here are two possibilities to reach the rows you = want, You probably have a a logical rule to put in the WHERE = close according to date or value.</FONT></P> <P><FONT SIZE=3D2>select A.Date as OLD_DATE, A.Value as Val, B.Date as = New_DATE, B.Value as New_VAl</FONT> <BR><FONT SIZE=3D2>from ABC A, ABC B</FONT> <BR><FONT SIZE=3D2>WHERE A.Date < B.Date</FONT> <BR><FONT SIZE=3D2>and A.Value =3D B.Value -4</FONT> </P> <P><FONT SIZE=3D2>select A.Date as OLD_DATE, A.Value as Val, B.Date as = New_DATE, B.Value as New_VAl</FONT> <BR><FONT SIZE=3D2>from ABC A, ABC B</FONT> <BR><FONT SIZE=3D2>WHERE A.Value =3D B.Value -4</FONT> </P> <P><FONT SIZE=3D2>Hope this helps, </FONT> </P> <P><FONT SIZE=3D2>Ruth Fouks</FONT> <BR><FONT SIZE=3D2>Tvuna Software Industries LTD.</FONT> <BR><FONT SIZE=3D2>Petah - Tikva ISREAL</FONT> <BR><FONT SIZE=3D2>972-3-9242652/308</FONT> </P> <P><FONT SIZE=3D2>-----Original Message-----</FONT> <BR><FONT SIZE=3D2>From: Pallav Kalva [<A = HREF=3D"mailto:pallav_at_starmedia.net">mailto:pallav_at_starmedia.net</A>]</F= ONT> <BR><FONT SIZE=3D2>Sent: Saturday, June 24, 2000 4:04 AM</FONT> <BR><FONT SIZE=3D2>To: Multiple recipients of list ORACLE-L</FONT> <BR><FONT SIZE=3D2>Subject: SQL Query</FONT> </P> <BR> <BR> <BR> <P><FONT SIZE=3D2>Hi Guys,</FONT> </P> <P><FONT SIZE=3D2>I have a table ABC with 2 columns = like</FONT> </P> <P><FONT = SIZE=3D2>Date = Values</FONT> <BR><FONT = SIZE=3D2>---- = ------</FONT> </P> <P><FONT SIZE=3D2>22-JUN-00 = 1</FONT> </P> <P><FONT SIZE=3D2>22-JUN-00 = 2</FONT> </P> <P><FONT SIZE=3D2>.</FONT> </P> <P><FONT SIZE=3D2>.</FONT> </P> <P><FONT SIZE=3D2>23-JUN-00 = 5</FONT> </P> <P><FONT SIZE=3D2>23-JUN-00 = 6</FONT> </P> <BR> <P><FONT SIZE=3D2>I want the result to be </FONT> </P> <P><FONT SIZE=3D2>OLD_DATE = VAL = NEW_DATE VAL</FONT> <BR><FONT SIZE=3D2>-------- = --- = -------- ---</FONT> <BR><FONT SIZE=3D2>22-JUN-00 = 1 = 23-JUN-00 5</FONT> </P> <P><FONT SIZE=3D2>22-JUN-00 = 2 = 23-JUN-00 6 </FONT> </P> <BR> <P><FONT SIZE=3D2>Is there any simpler way to do that ???</FONT> </P> <BR> <P><FONT SIZE=3D2>Thanks!</FONT> <BR><FONT SIZE=3D2>Pallav</FONT> </P> <P><FONT SIZE=3D2>-- </FONT> <BR><FONT SIZE=3D2>Author: Pallav Kalva</FONT> <BR><FONT SIZE=3D2> INET: pallav_at_starmedia.net</FONT> </P> <P><FONT SIZE=3D2>Fat City Network Services -- (858) = 538-5051 FAX: (858) 538-5051</FONT> <BR><FONT SIZE=3D2>San Diego, = California -- Public Internet = access / Mailing Lists</FONT> <BR><FONT = SIZE=3D2>---------------------------------------------------------------= -----</FONT> <BR><FONT SIZE=3D2>To REMOVE yourself from this mailing list, send an = E-Mail message</FONT> <BR><FONT SIZE=3D2>to: ListGuru_at_fatcity.com (note EXACT spelling of = 'ListGuru') and in</FONT> <BR><FONT SIZE=3D2>the message BODY, include a line containing: UNSUB = ORACLE-L</FONT> <BR><FONT SIZE=3D2>(or the name of mailing list you want to be removed =Received on Sun Jun 25 2000 - 02:02:23 CDT