I�ve got large data set. Each day I load in 8000 stocks, info about how they
did that day. So the primary key, an auto incrementing value, numbers them
in order.

But I�d like to sort by Stock ticker, then pull the value from the next
day�s price to stick at the end of a row for the current day�s information.

I got some help the other day on how to lag across records using the primary
key and a self join, but after a sort the primary keys are not really what
I�m after.... I want tomorrow�s price for the same stock (next record in a
sorted dataset) not the next value of the primary key (which is for a
different stock).

I�m stumped. 

I thought if I made an index on �ticker� and �date� combined, that I could
use that index for the lag and I�d be pretty close.

But
    a) I might be very wrong about that, and
    b) can�t find any documentation on how to call up that index�s value as
part of a SELECT�s record set.

Any ideas? Am I close?


-- 
David L. Van Brunt, Ph.D.
Outlier Consulting & Development
mailto: <[EMAIL PROTECTED]>


Reply via email to