Hello,
I have this query:
If I start this query with tblData (220,000 data points), it is calulcated in at least 7 hours.
Does someone have an idea how I can speed up this query?
PS: I set an index in tblData to PosNr (without duplicates), PriceDate (with duplicates) and company (with duplicates)
Thank you very much in advance!
Magnus
I have this query:
Code:
SELECT A.PosNr, A.PriceDate, A.Company, A.Price, (SELECT TOP 1
B.Price
FROM
tblData As B
WHERE
B.Company= A.Company
AND
B.PosNr < ( A.PosNr - 364 )
ORDER BY
B.PosNr DESC ) AS PreisYearBefore
FROM tblData AS A;
If I start this query with tblData (220,000 data points), it is calulcated in at least 7 hours.
Does someone have an idea how I can speed up this query?
PS: I set an index in tblData to PosNr (without duplicates), PriceDate (with duplicates) and company (with duplicates)
Thank you very much in advance!
Magnus