H
Henry
I would like to compare the values of one record with another record for the
previous year, for example to calculate growth. I can extract and calculate
these values using the SQL below however I am unable to update the records
as I am told the recordset is not updatable in MS Access.
Create table Results
(ResultID INT IDENTITY,
ResultYear DateTime,
ResultValue Int)
INSERT INTO Results (ResultYear, ResultValue) VALUES('1 Jan 2005', 500)
INSERT INTO Results (ResultYear, ResultValue) VALUES('1 Jan 2003', 30)
INSERT INTO Results (ResultYear, ResultValue) VALUES('1 Jan 2004', 100)
INSERT INTO Results (ResultYear, ResultValue) VALUES('1 Jan 2002', 20)
SELECT t1.ResultID, t1.ResultYear, t1.ResultValue,
t1.ResultValue-t2.ResultValue AS Growth
FROM Results t1 LEFT JOIN Results t2 ON t2.ResultYear=DATEADD (yyyy , -1,
t1.ResultYear )
Any help here would be greatly appreciated.
Thanks
Henry
previous year, for example to calculate growth. I can extract and calculate
these values using the SQL below however I am unable to update the records
as I am told the recordset is not updatable in MS Access.
Create table Results
(ResultID INT IDENTITY,
ResultYear DateTime,
ResultValue Int)
INSERT INTO Results (ResultYear, ResultValue) VALUES('1 Jan 2005', 500)
INSERT INTO Results (ResultYear, ResultValue) VALUES('1 Jan 2003', 30)
INSERT INTO Results (ResultYear, ResultValue) VALUES('1 Jan 2004', 100)
INSERT INTO Results (ResultYear, ResultValue) VALUES('1 Jan 2002', 20)
SELECT t1.ResultID, t1.ResultYear, t1.ResultValue,
t1.ResultValue-t2.ResultValue AS Growth
FROM Results t1 LEFT JOIN Results t2 ON t2.ResultYear=DATEADD (yyyy , -1,
t1.ResultYear )
Any help here would be greatly appreciated.
Thanks
Henry