|M| 郁闷又把那条Group by 语句忘了大家帮看看 SQL查询语句
表
编号 用户 销售鸡蛋数 生成苹果数 销售日期开始 销售日期结未 是否有效
id user saleage saleapple begindate enddate istrue
1 1 10 8 2007-1-1 2007-1-31 1
2 1 12 7 2007-1-1 2007-1-31 1
3 2 8 9 2007-1-1 2007-1-31 1
4 2 8 10 2007-2-1 2007-02-28 1
5 2 12 11 2007-2-1 2007-02-28 1
6 1 11 15 2007-3-1 2007-03-31 1
7 3 19 12 2007-3-1 2007-03-31 0
要求:查询出每个时段里里面每个用的合计销售额
如结果:
user saleage saleapple begindate enddate
1 22 15 2007-1-1 2007-1-31
2 8 9 2007-1-1 2007-1-31
2 20 21 2007-2-1 2007-02-28
1 11 15 2007-3-1