You can use aggregation function as sum and group by date and product
select date, product, sum(quantity)
from my_table
group by date, product
尝试这个 -
SELECT date as Date, product as Product, SUM(quantity) as Quantity FROM Sales GROUP BY date, product
Try this:
select cast(date as date) as 'Date', Product, sum(quantity) as 'Quantity'
from sales
group by cast(date as date), Product
order by cast(date as date) asc
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.