Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Calculate FIFO values for stocks in my depo using ASP

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2000-09-17 : 15:40:02
Thor writes "Dear SQL Team

I would like to calculate a FIFO bought price for all stocks in my depo. I gather the proces is somthing like this:

1) Get all stock where sum is greater than zero = actual amount

2) For each stock symbol in depo - go back for each bought trade (where the trade consists of amount of stocks pr. trade and stock price) in descending order and subtract it from the actual amount in depo.

I know how to do the first part 1) but how do I perform the subquery to iterate through enough trades in order to have just enough to calculate the FIFO bought price?

Hope you can help me

Best regards

Thor"

   

- Advertisement -