PC Review


Reply
Thread Tools Rate Thread

Comparing a day's fields with the previous day's fields

 
 
Anon
Guest
Posts: n/a
 
      18th Jan 2004
Hi,

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.

Some sample data from the table is below:

ID symbolID quotedate open high low close volume
adjustedClose
1 124 25 November 2003 8778.29 8778.29 8778.29 8778.29
0 8778.29
2 124 26 November 2003 8768.56 8768.56 8768.56 8768.56
0 8768.56
3 124 27 November 2003 8759.74 8759.74 8759.74 8759.74
0 8759.74
4 124 28 November 2003 8770.85 8770.85 8770.85 8770.85
0 8770.85
5 124 01 December 2003 8891.18 8891.18 8891.18 8891.18
0 8891.18
6 124 02 December 2003 8744.28 8744.28 8744.28 8744.28
0 8744.28
7 124 03 December 2003 8818.29 8818.29 8818.29 8818.29
0 8818.29

Thanks,

Anon.


 
Reply With Quote
 
 
 
 
John Vinson
Guest
Posts: n/a
 
      18th Jan 2004
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
 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Comparing multiple fields in an array with multiple fields in a table. lisamariechemistry@yahoo.com Microsoft Excel Programming 2 14th Jun 2007 11:51 PM
Comparing two fields printman2000@gmail.com Microsoft Access Reports 3 9th Aug 2006 10:18 PM
Auto fill Form Fields from previous Variable fields? =?Utf-8?B?T21hU2NvdHQ=?= Microsoft Word Document Management 3 19th Jul 2006 09:09 PM
comparing fields =?Utf-8?B?c3RhZzI0Ng==?= Microsoft Access Queries 1 6th Dec 2004 04:57 PM
Yes/No fields and comparing fields swm Microsoft Access Reports 0 9th May 2004 10:42 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:11 AM.