month salesPerMonth
1 | 2 |
2 | 3 |
3 | 2 |
4 | 4 |
5 | 3 |
6 | 3 |
写条SQL语句把上表转成下表:
month 总销量
1 2
2 5
3 7
4 11
5 14
6 17
答案:
selects2.[month],Sum(s1.salesPerMonth)as'总销量'
FromSaless1,Saless2
where s1.[month]<=s2.[month]
Groupbys2.[month]