sql 指定时间段内分组计算
abcdA1232011-1-1A1112011-1-2A1332011-1-3计算3天内的统计abcA367...
a b c d
A 1 2 3 2011-1-1
A 1 1 1 2011-1-2
A 1 3 3 2011-1-3
计算3天内的统计
a b c
A 3 6 7 展开
A 1 2 3 2011-1-1
A 1 1 1 2011-1-2
A 1 3 3 2011-1-3
计算3天内的统计
a b c
A 3 6 7 展开
2个回答
展开全部
应该镇配是五个盯旅纤字段吧?
select a,sum(b) as b ,sum(c) as c,sum(d) as d
from table1
where e between '2011-1-1'凯仿 and '2011-1-3'
group by a
改成这样就可以了
select a,sum(b) as b ,sum(c) as c
from table1
where d between '2011-1-1' and '2011-1-3'
group by a
select a,sum(b) as b ,sum(c) as c,sum(d) as d
from table1
where e between '2011-1-1'凯仿 and '2011-1-3'
group by a
改成这样就可以了
select a,sum(b) as b ,sum(c) as c
from table1
where d between '2011-1-1' and '2011-1-3'
group by a
2013-01-05
展开全部
select sum(a),sum(b),sum(c) from table group by d d是时间字段么,还是判烂那大写的A是一列,反正谨冲亏就这个意思祥神了
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |