Question
Creating Cross Tab Report
Hello Community Members,
I've written a query that generates Cross Tab or Pivot. Image Below. My Query is as follows
SELECT * FROM
(
SELECT TOP(100) PERCENT production.Line_FK_ID,
Lines.LineName,production.OP_FK_ID,
Operations.OperationName,
[Shift].ShiftID,[Shift].ShiftName,
production.op_Time_From,
production.Production
FROM production
JOIN Operations
on Operations.opID=production.OP_FK_ID
JOIN Lines
on Lines.lineID=production.Line_FK_ID
JOIN [Shift]
on [Shift].ShiftID=production.Shift_FK_ID
WHERE
ShiftID in (1)
and op_date in ('2021-07-08')
Order by production.op_Time_From
) Report
PIVOT
(
Sum (Production)
FOR OP_TIME_FROM
IN (
[06:30:00],[07:30:00],[08:30:00],[09:40:00],[10:30:00],[11:30:00],[13:00:00],[13:30:00],[14:30:00]
)
) As Pivot_Report
I want to make PDF report in which Production Line Wise for 6 operations for each hour. I am unable to Pivot the Hours Horizontly. The CFDUMP is as follows

