Q&A about the site for music historians, critics, and fans
CREATE table #yourtable ([Id] varchar(12), [Access] varchar(3), [DB1] varchar(1), [DB2] varchar(1), [DC1] varchar(1)) ; INSERT INTO #yourtable ([Id],[Access], [DB1], [DB2], [DC1]) VALUES ('1','DB1', 'Y',null,null), ('1','DB2', null,null,null), ('1','DC1', null,null,'Y'), ('2','DB1', 'Y',null,null), ('2','DB1', null,'Y',null), ('3','DC1', null,null,'Y') ; SELECT ID,ACCESS,DB1,DB2,DC1 FROM #yourtable;