As this is posted in a SQL Server 2005 Forum, the following will work as well:
if object_id('tempdb..#TestTable') is not null
drop table #TestTable;
create table #TestTable (
COMCOD nchar(4),
PARTYCODE nchar(6) PRIMARY KEY,
PARTYNAME nvarchar(250));
insert into #TestTable
values
('3305','100028','Premier Cement Mills Ltd.'),
('3305','100029','Premier Cement Mills Ltd.'),
('3305','100030','Premier Cement Mills Ltd.'),
('3305','100031','Premier Cement Mills Ltd.'),
('3305','100032','Premier Cement Mills Ltd.'),
('3305','100033','Electro Power Engineering Ltd.'),
('3305','100034','Electro Power Engineering Ltd.'),
('3305','100035','Electro Power Engineering Ltd.'),
('3305','100036','Electro Power Engineering Ltd.'),
('3305','100037','Islam Trading Consortium Ltd.'),
('3305','100038','Islam Trading Consortium Ltd.'),
('3305','100039','Islam Trading Consortium Ltd.'),
('3305','100040','Mr. Ehsanur Rahman'),
('3305','100041','Mr. Ehsanur Rahman');
with BaseData as (
select
COMCOD,
PARTYCODE,
PARTYNAME,
RN = ROW_NUMBER() over (partition by COMCOD, PARTYNAME order by PARTYCODE asc)
from
#TestTAble
)
select
COMCOD,
PARTYCODE,
PARTYNAME
from
BaseData
where
RN = 1
order by
COMCOD,
PARTYCODE;
if object_id('tempdb..#TestTable') is not null
drop table #TestTable;
GO