On Sun, 18 Jan 2004 20:08:50 -0000, "Anon" <(E-Mail Removed)>
wrote:
>I have a table with a lot of stock data in it, and need to do calculations
>between adjacent days.
>
>For example, one result that I need to pull from the database is the
>difference between two adjacent days closing prices.
>
>Adjacent days are not always 1 day apart, and this is giving me some trouble
>with writing a query which doesn't hang my machine.
>
>How do I do this in an optimal fashion? There are thousands of rows in my
>table.
A Self Join query joining the table to itself on the SymbolID with a
criterion on the date of
=DMax("[Quotedate]", "[yourtable]", "[Quotedate] < #" & [Quotedate] &
"#")
Be sure that Quotedate is indexed (nonuniquely). Even so, don't expect
this to run very fast!
John W. Vinson[MVP]
Come for live chats every Tuesday and Thursday
http://go.compuserve.com/msdevapps?loc=us&access=public