-- Create your pivot table -- note that an empty string is added against each name-- This extra table might seem to be a lot of work, but it is a clean and fast way of codingDECLARE @Pivotable TABLE ([Name] nvarchar(15),Phil varchar(1),Larry varchar(1),Bill varchar(1))INSERT INTO @Pivotable ([Name],Phil,Larry,Bill) VALUES ('Phil','',NULL,NULL) INSERT INTO @Pivotable ([Name],Phil,Larry,Bill) VALUES ('Larry',NULL,'',NULL) INSERT INTO @Pivotable ([Name],Phil,Larry,Bill) VALUES ('Bill',NULL,NULL,'')

-- Pivot statement -- this gives more ablility to manipulate and use isnull and other functions in your statement-- I did this in SQL2000, so it is fully backwards compatible as well. -- The pivot statement in SQL is very effective if you need a simple pivoting onlySELECT [Date], Phil = Max(Code+P.Phil), Larry = Max(Code+P.Larry), Bill = Max(Code+P.Bill)FROM @table t join @Pivotable P on T.[Name] = P.[Name]group by [Date]

-- Create your pivot table -- note that an empty string is added against each name-- This extra table might seem to be a lot of work, but it is a clean and fast way of codingDECLARE @Pivotable TABLE ([Name] nvarchar(15),Phil varchar(1),Larry varchar(1),Bill varchar(1))INSERT INTO @Pivotable ([Name],Phil,Larry,Bill) VALUES ('Phil','',NULL,NULL) INSERT INTO @Pivotable ([Name],Phil,Larry,Bill) VALUES ('Larry',NULL,'',NULL) INSERT INTO @Pivotable ([Name],Phil,Larry,Bill) VALUES ('Bill',NULL,NULL,'')

-- Pivot statement -- this gives more ablility to manipulate and use isnull and other functions in your statement-- I did this in SQL2000, so it is fully backwards compatible as well. -- The pivot statement in SQL is very effective if you need a simple pivoting onlySELECT [Date], Phil = Max(Code+P.Phil), Larry = Max(Code+P.Larry), Bill = Max(Code+P.Bill)FROM @table t join @Pivotable P on T.[Name] = P.[Name]group by [Date]

But it is not dynamic and forcing you to add each records manually.But thanks!