Gossamer Forum
Home : General : Databases and SQL :

Group Function Question

Quote Reply
Group Function Question
Hello All,

I am trying to get the sum of these (18000, 18000, 24000, 32000)

When I do the Sum function, it would add all of these values. But what I need is that if it can only add (18000,24000,32000). In another word, if there's a duplicate value, it won't add twice. I really don't know what function would make it work like that. Please help me out. If you could give an example code so I can understand it more, that would be great.Thank you for your time.
Quote Reply
Re: [hdnguyen3] Group Function Question In reply to
You could try:

SELECT SUM(DISTINCT(Column))
FROM Table
GROUP BY Column

Cheers,

Alex
--
Gossamer Threads Inc.
Quote Reply
Re: [Alex] Group Function Question In reply to
Cool, it works perfect.. Thanks a lot Alex.