SELECT EmpName, [Visited], [ptp] FROM (SELECT EmpName, Code FROM @ClientVisit) As Souce PIVOT (COUNT(Code) FOR Code IN ([Visited], [ptp])) As p
SELECT EmpName, [Visited], [ptp] FROM (SELECT DISTINCT EmpName, Code FROM @ClientVisit) As Souce PIVOT (COUNT(Code) FOR Code IN ([Visited], [ptp])) As p.
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)