0

I am looking to generate a report which is basically a attendance report using SQL query from table data rows; I have employee punch data as row in table with columns such as PDate | EmpCode | EmpName | PStatus | OT enter image description here

The above image shows the snap of data in table.

I am looking to generate the results as shown below enter image description here

1 Answers1

0
SELECT * FROM ( SELECT [Name], [Value] FROM [dbo].[Table] ) AS SourceTable PIVOT ( MAX([Value]) FOR [Name] IN ( [FirstName], [LastName], [Email], [Phone] ) ) AS PivotTable

I hope it will help you.

F. Müller
  • 3,969
  • 8
  • 38
  • 49