【发布时间】:2019-01-16 17:21:43
【问题描述】:
我有这张桌子
我想忽略 productNo 并相应地汇总所有产品计数。
select sum(count), max(productNo)
from Table
where date between 117 and 118
group by product
这个给出了错误的结果...
我想要每个 Product-ProductNo 组合的计数总和
【问题讨论】:
-
您的问题没有解释为什么您的查询包含 max(productNo)
-
标记您正在使用的 DBMS(即
MySQL、SQL Server等)。 -
MySql,我现在肯定会标记
-
因为我只想得到一个产品,没有每个日期