Do you have multiple DISTINCT values for NAME for the SAME Compound_Id,Name_Type_Id pair? I assume not.Have a look at this, and see if it works for you:Create Table DupsBeHere(compound_id integer,[name] varchar(150),name_type integer)goinsert into DupsBeHere (compound_id,[name],name_type) values (1,'a1',1)insert into DupsBeHere (compound_id,[name],name_type) values (1,'a2',2)insert into DupsBeHere (compound_id,[name],name_type) values (1,'a3',3)insert into DupsBeHere (compound_id,[name],name_type) values (1,'a4',4)insert into DupsBeHere (compound_id,[name],name_type) values (2,'B1',1)insert into DupsBeHere (compound_id,[name],name_type) values (2,'B2',2)insert into DupsBeHere (compound_id,[name],name_type) values (2,'B2',3)insert into DupsBeHere (compound_id,[name],name_type) values (2,'B4',4)CREATE TABLE compound_name (id int identity(1,1) primary key,compound_id int,compound_name varchar(150),compound_desc varchar(250),compound_synonym varchar(150),compound_formula varchar(50),compound_trade_nme varchar(50))INSERT INTO compound_name (compound_id,compound_name,compound_desc,compound_synonym,compound_formula)SELECT compound_id, max(case when name_type = 1 then [name] else NULL end) as compound_name, max(case when name_type = 2 then [name] else NULL end) as compound_desc, max(case when name_type = 3 then [name] else NULL end) as compound_synonym, max(case when name_type = 4 then [name] else NULL end) as compound_formulaFROM DupsBeHeregroup by compound_idSELECT * from compound_name
*##* *##* *##* *##* Chaos, Disorder and Panic ... my work is done here!