Re: Duplicate records



P.S.Bell schrieb:
I had a query with a sum on a detail field. This was fine until I found I needed to apply proper rounding prior to summing. It now lists a row for each detail record. I have guessed/tried to add the case to the group by instead of the field but I am told I cannot have a subclause.

[...]


Pat Bell


CASE is not possible in the GROUP BY.
You should put the rounding algorithm inside a stored function, so
that you can simply call SUM(dbo.MYROUND(ItemActions.VatTotalSales)).
That one can be put into the GROUP BY clause.

Ralf
.