虾米、木木 回复 tangbao(提问者)你是只要18年 12月的 还是所有的月份都要?
如果是只要 12月份的 就 sum(case when time between \'2018-11-01\' and \'2018-11-30\' then total else 0 end) as upMonth, sum(case when time between \'2018-12-01\' and \'2018-12-30\' then total else 0 end) as currentMonth
如果全要就用lag、lead函数