MySQL的:
我的表
Name | Profit | Date
Cap | 20 | 2014-04-19 08:52:00
Cap | 15 | 2014-04-19 07:52:00
Cup | 25 | 2014-04-19 07:55:00
Cup | 22 | 2014-04-18 13:05:30
我想日期范围2014-04-19 00:00:00至2014-04-19 23:59:59:
结果示例:
Name| Profit
Cap | 35
Cup | 25
答案 0 :(得分:0)
试试这个:
select name, sum(profit)
from yourtable
WHERE
date >= '2014-04-19 00:00:00'
AND
date < '2014-04-19 23:59:59'
group by name
答案 1 :(得分:0)
试试这个
select Name,sum(Profit)
from table1
WHERE
Date >='2014-04-19 00:00:00'
AND
Date < '2014-04-19 23:59:59'
group by name