you mean the previous price? and you mean a table rather than .csv file?
perfectly doable, try something like
Code:
c.row, c.time, iif(p.pricetype="Bid",p.price,c.price) as bidprice, iif(p.pricetype="Ask",p.price,c.price) as askprice
from tblPrices as C, tblPrices as P
WHERE P.Row =(SELECT Max(Row) from tblPrices WHERE Row<c.Row AND pricetype<>c.pricetype)
if you table has a mixture of stocks then the query would be
Code:
SELECT c.row, c.time, iif(p.pricetype="Bid",p.price,c.price) as bidprice, iif(p.pricetype="Ask",p.price,c.price) as askprice
from tblPrices as C INNER JOIN tblPrices as P ON C.StockID=P.StockID
WHERE P.Row =(SELECT Max(Row) from tblPrices WHERE StockID=c.StockID AND Row<c.Row AND pricetype<>c.pricetype)
if you need to put these back to a .csv file, use transfertext
not time and type are reserved words, use them at your peril