Since your table column and query has few mismatch
I think use of distinct with group by is not required..
I have created a test query for your requirement in sort using 2 columns on basis of your requirement
"i want to run a query to get total rcom with no repeatation of mid"
Like this:
create table #temp(
rcom int,
mid int
)
insert into #temp(rcom,mid)values(0,108)
insert into #temp(rcom,mid)values(0,108)
insert into #temp(rcom,mid)values(100,109)
insert into #temp(rcom,mid)values(100,109)
insert into #temp(rcom,mid)values(100,110)
insert into #temp(rcom,mid)values(100,110)
select * from #temp
select SUM(rcom) as sum_rcom,mid from #temp group by mid
and Output is:
sum_rcom mid
0 108
400 109
400 110
Is this helpful..?