我有一个包含3列的表格。(Date,Name,Weight
)
Date Name Weight
2015-01-01 sam 100
2015-01-01 joy 100
2015-01-01 max 110
2015-01-02 sam 200
2015-01-02 max 100
当我输入日期时,我希望得到整个权重的总和,如下所示。
Date Whole Weight
2015-01-01 310
2015-01-02 300
答案 0 :(得分:0)
尝试此查询:
select date, sum(weight) as whole_weight from your_table group by date;
如果您想自己输入日期,请这样做:
select date, sum(weight) as whole_weight from your_table where date='enter the date here';