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: Jim Kennedy <kennedy-family_at_attbi.com>
Date: Sat, 14 Dec 2002 20:02:29 GMT
Message-ID: <p7MK9.352858$NH2.24453@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 - 14:02:29 CST

Original text of this message

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