How do I SUM DISTINCT Rows?

后端 未结 3 1859
误落风尘
误落风尘 2020-12-19 05:51

I\'m struggling with a query where I need to SUM DISTINCT Rows. There has to be a way to do this... but I\'m lost.

Here\'s what I\'ve got:

SELECT D         


        
3条回答
  •  孤城傲影
    2020-12-19 06:02

    An easy answer is use "group by". Group by has the same effect with the same fields as distinct, but allows you to use aggregate functions. You can add a "Having" clause after the group by to filter what records you would like to see.

提交回复
热议问题