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

Home -> Community -> Usenet -> c.d.o.misc -> Re: help with sql statement

Re: help with sql statement

From: user <utagi_at_yahoo.com>
Date: Sun, 15 Dec 2002 13:46:07 +0800
Message-ID: <3dfc167e$1_1@news.tm.net.my>


i've actually found a way to do it .. but now ... i'm face another problem .....

how to i create a sql statement where it returns the value of the latest date's volume minus the second latest date's volume ?

"Jim Kennedy" <kennedy-family_at_attbi.com> wrote in message news:p7MK9.352858$NH2.24453_at_sccrnsc01...
> how about max?
> select * from indexs where indate=max(indate);
> or
> for 2 most recent
> select indate,indexs,volume from indexs i where indate=max(indate)
> or indate=max((select indate from indexs i2 where
i2.indate<i.indate ))
> )
> order by indate desc;
>
> Also if you look in the documentation there are a bunch of analytical
> functions that might do it easier and better. I'm too lazy to look.
> Jim
>
> "user" <utagi_at_yahoo.com> wrote in message
> news:3dfade85$1_2_at_news.tm.net.my...
> > does anybody know what is the sql statement to retrieve the last date in
a
> > table ?
> > i need the statement to retrieve the volume of the last and 2nd last
date
> > and display them into a text box in my vb ....
> >
> > SQL> select * from indexs;
> >
> > INDATE INDEXS VOLUME
> > --------- ---------- ----------
> > 29-JUN-00 830.25 237
> > 30-JUN-00 833.37 160
> > 03-JUL-00 793.93 104
> > 04-JUL-00 807.87 89
> >
> > thanks
> >
> >
>
>
Received on Sat Dec 14 2002 - 23:46:07 CST

Original text of this message

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