As we know, the SUM aggregate function is often used with the GROUP BY clause.

A typical use of SUM is: **SUM(distinct salary)**.

In the above usecase, only the distinct salary values will be summed.

I would like to know if I can do a SUM on a particular column and the DISTINCT on another column.

Something like: **SUM(DISTINCT empcode salary)**.

I cannot do this in the SQL-World, but is it possible to achieve this using some in-built DB2 functions.

Thanks in advance.