Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> I need help with this sql

I need help with this sql

From: Jake <me_at_heyjay.com>
Date: Sat, 30 Aug 2003 00:06:33 -0500
Message-ID: <bipbdb$jde$1@bob.news.rcn.net>


Hi,

I have a stock quote table:

SQL> desc quote

 Name                                      Null?    Type
 ----------------------------------------- -------- ------------------------
----
 ID                                        NOT NULL NUMBER
 SECURITYID                                         NUMBER
 BID                                                NUMBER
 ASK                                                NUMBER
 LAST                                               NUMBER
 VOLUME                                             NUMBER
 QUOTEDATE                                          DATE

what I want to do is for each quote, select all the quotes that are between the quotedate of the row I'm on and quotedate plus 1 min. from that group I need to find the open (first quote), min(quote) low, max(quote) hi, and last quote in the group. I can find open, hi, low but don't know how to find the last quote. Here's what I've got so far

select a.quotedate, min(a.last) open, min(b.last) lo, max(b.last) hi from quote a,
quote b
where a.securityid = b.securityid
and b.quotedate >= a.quotedate
and b.quotedate <= a.quotedate + 120/24/60/60 group by a.quotedate

Does anyone know how to find the final quote that is <= 60/24/60/60 + the first quote?

thanks
Jay Received on Sat Aug 30 2003 - 00:06:33 CDT

Original text of this message

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