VoucherID amount 1 5 1 5 2 2 3 7 3 7 3 7
amount 14
select VoucherID, Sum(Amount) from ((select Distinct VoucherID, amount from table)) xx
with cte (voucherid, amount) as ( select Distinct voucherid, amount from table1 )select sum(amount) as amount from cte
select sum(t1.amount) from(select distinct * From sample1 )t1 left join (select distinct *From sample1) t2 on t1.id=t2.id and t1.amount=t2.amount
Select voucherID, SUM(AMOUNT) FROM ( SELECT Row_Number() over(partition by voucherId, Amount group by voucherID, Amount) as rownr, voucheriD, amount ) as collection where rownr = 1
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)