0

how can I select in a Oracle DB all columns but some of them DISTINCT. I have columns A,B,C that I want distinct and column D that I want the sum of the rows.

A   B   C   D
1   2   3   10
1   2   3   20
1   2   4   1000

And I want the result

A   B   C   D
1   2   3   30
1   2   4   1000

Thanks!

closed as off-topic by ypercubeᵀᴹ, dezso, Michael Green, RLF, Max Vernon Oct 20 '15 at 14:51

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Too localized - this could be because your code has a typo, basic error, or is not relevant to most of our audience. Consider revising your question so that it appeals to a broader audience. As it stands, the question is unlikely to help other users (regarding typo questions, see this meta question for background)." – ypercubeᵀᴹ, Michael Green, Max Vernon
If this question can be reworded to fit the rules in the help center, please edit the question.

3

It's easy-peasy:

select a,b,c,sum(d)
from yourtable
group by a,b,c;

Probably too simple for this site, to be honest.

Not the answer you're looking for? Browse other questions tagged or ask your own question.