Well, my query is :
SELECT *,
(aliasA.avalue+aliasB.avalue) as mycustomsum
FROM (SELECT bla,bla,bla ...) as aliasA
INNER JOIN (SELECT bla,bla,bla ...) as aliasB
ON aliasA.mydate=aliasB.otherdate
order by month desc
Now i would like another column of itself but showing mycustomsum of 12 months before ! Self join of alias doesn't work !
in other words the result of my query is :
2017-12 | 123
2017-11 | 456
.
.
.
2016-12 | 789
2016-11 | 321
and i would like :
2017-12 | 123 | 789
2017-11 | 456 | 321
.
.
.
2016-12 | 789 | null
2016-11 | 321 | null
Just want to compare current year to last year , month by month , Its just "show the result from 12 rows ago" ! Any idea ?