Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一张桌子有 2 个字段产品和价格。
现在,如果产品多次具有不同价格的苹果价值,例如,
Product and Price. apple 5 apple 10 apple 15 bananaa 20
现在我只想获取苹果价值 1 次和所有苹果价格的总和。我怎样才能在这个概念中获取价值。苹果不仅仅是固定价值,它可以是桌子上的任何产品,如香蕉、葡萄等......
select Product,SUM(Price) from fruits group by Product
每个人都必须从某个地方开始...
Select Product, Sum(Price) as TotalApple From TableName Where Product='apple' Group by Product
希望我不只是为你做作业:)