Hello Everyone, I am wondering how can I create Cross Tabs queries with SQL Server 2008. I have fields for Job Numbers and Employees and I want to show that how many hours an Employee has worked on the specific job.
For sample, this is what I want. link text
I tried PIVOT
but that didn't work for. Later I want to export this data to EXCEL with C#.
UPDATE:
Okay here is the query.
SELECT Ename, JobNum, LaborHrs
FROM CombinedLabor
which will return the list of employee name, with job nums and labor hrs.
The existing table is as follows:
ENAME JOBNUM LABORHRS
abc N6880 8.0
abc N6880 2.5
xyz N7860 9.5
... ... ...
So I want something like this
N6880 N7860 ... Total Hrs
abc 10.5 0.0 ... 10.5
xyz 0.0 9.5 ... 9.5