insert into [DBL_Group].[dbo].[tblGmMachineZeroHour]( fldDate, fldOrderNo, fldUnit, [fldLine], fldMachineName, fldMachineQty,fldReasonKey,fldFrom, [fldTo], fldTotalTime,[fldReason])
SELECT
Cast( fldDate as Date), [fldOrderNo], [fldUnit], [fldLine],[fldMachineName],[fldMachineQty],[fldReasonKey], [StartProblem],[Confirmation],
CAST(DATEADD(MINUTE,DATEDIFF(MINUTE,[StartProblem],[Confirmation]),'1900-01-01 00:00:00.000') AS Datetime) ,
[fldReason]
FROM [DBL_Group].[dbo].[tblGmMachineZeroHourTest] where [StartProblem] is not null and [Confirmation] is not null
and DATEDIFF(Day,[StartProblem],[Confirmation])<1 and fldReasonKey is not null