根据时间进行累加

group by

For the table QA, the query about the accumulation of the count of questions should be:
Table: QA
Date          Count
Feb              10
March          20
April             30

select q1.date, sum(q2.count) as acm
from QA q1, QA q2
where q1.date <= q2.date
group by q1.date
order by q1.date;

猜你喜欢

转载自blog.csdn.net/betty1121/article/details/80837282