I am trying join a table (sheet1) on itself 3 times on the column "DATE". But each time I join the next table, I want it to be on the date 3, 6, and 9 months prior to the original table's date.
I tried this query on Microsoft SQL Server Management Studio using another similar table and it runs correctly, but when I run the query through SQL in Microsoft Access I am getting a SYNTAX ERROR (missing operator).
Any help would be appreciated, thanks!
Sheet1 has 2 columns, "Date" and "SA372 returns".
select
Sa.Date ,
Sa.[SA372 returns],
(1+ Sa.[SA372 returns])*(1 + Sb.[SA372 returns])* (1+ Sc.[SA372 returns])*(1+ Sd.[SA372 returns]) as Compound
from sheet1 Sa
left join
sheet1 Sb on Sb.Date = DATEADD(day,-1,dateadd(month,-3,DATEADD(day,1,Sa.Date)))
left join
sheet1 Sc on Sc.Date= DATEADD(day,-1,dateadd(month,-6,DATEADD(day,1,Sa.Date)))
left join
sheet1 Sd on Sd.Date= DATEADD(day,-1,dateadd(month,-9,DATEADD(day,1,Sa.Date)))
order by Sa.date asc