++++++++++++++++++++old++++++++++++++++(IPACS-C-PipeSupport-RawMaterialMTO View) SELECT T0.[LineNo], T0.LineState, T0.SheetNo, T0.SheetState, T0.RevNo, T0.SJoint, T0.Contractor, T0.SupportType, T0.PartNo, T0.[JH-ID], T0.[Adish-Code] AS [Orginal Adish Code], T0.[Part-Code] AS [Orginal Part-Code], T0.Lenght AS [Orginal Lenght], T0.Width AS [Orginal Width], T0.Qty AS [Orginal Qty], T0.[Part MTO value] AS [Orginal Part MTO value], T0.[Part Unit] AS [Orginal Part Unit], T1.[Substituted Part Code], ISNULL(T1.Lenght, 0) AS [Substituted Lenght], ISNULL(T1.Width, 0) AS [Substituted Width], ISNULL(T1.Qty, 0) AS [Substituted Qty], T0.FABorEREC, T0.PartLocation, T0.[AG/UG], T0.Zone, T0.Unit, T0.QtyJointSupport, T0.JointState, T0.[Shop Front Order], T0.[SFO Date], T0.[Shop FitUp Report], T0.[SFR Date], T0.[Shop Weld Report], T0.[SWR Date], T0.[Erection Front Order], T0.[EFO Date], T0.[Erection FitUp Report], T0.[EFR Date], T0.[Erection Weld Report], T0.[EWR Date], T0.Remark FROM (SELECT dbo.[IPACS-C-PipeSupport-JointHistory].[LineNo], dbo.[IPACS-C-PipeSupport-JointHistory].LineState, dbo.[IPACS-C-PipeSupport-JointHistory].SheetNo, dbo.[IPACS-C-PipeSupport-JointHistory].SheetState, dbo.[IPACS-C-PipeSupport-JointHistory].RevNo, dbo.[IPACS-C-PipeSupport-JointHistory].SJoint, dbo.[IPACS-C-PipeSupport-JointHistory].Contractor, dbo.[IPACS-C-PipeSupport-JointHistory].SupportType, dbo.[IPACS-C-PipeSupport-TypeRawMaterialMTO View].PartNo, dbo.[IPACS-C-PipeSupport-JointHistory].ID AS [JH-ID], dbo.[IPACS-C-PipeSupport-TypeRawMaterialMTO View].[Adish-Code], dbo.[IPACS-C-PipeSupport-TypeRawMaterialMTO View].[Part-Code], CONVERT(nvarchar, dbo.[IPACS-C-PipeSupport-JointHistory].ID) + ' | ' + dbo.[IPACS-C-PipeSupport-TypeRawMaterialMTO View].[Part-Code] AS [Sub-Link], dbo.[IPACS-C-PipeSupport-TypeRawMaterialMTO View].Lenght, dbo.[IPACS-C-PipeSupport-TypeRawMaterialMTO View].Width, dbo.[IPACS-C-PipeSupport-TypeRawMaterialMTO View].Qty, dbo.[IPACS-C-PipeSupport-TypeRawMaterialMTO View].[Part MTO value], dbo.[IPACS-C-PipeSupport-TypeRawMaterialMTO View].[Part Unit], dbo.[IPACS-C-PipeSupport-TypeRawMaterialMTO View].FABorEREC, dbo.[IPACS-C-PipeSupport-TypeRawMaterialMTO View].PartLocation, dbo.[IPACS-C-PipeSupport-JointHistory].[AG/UG], dbo.[IPACS-C-PipeSupport-JointHistory].Zone, dbo.[IPACS-C-PipeSupport-JointHistory].Unit, dbo.[IPACS-C-PipeSupport-JointHistory].QtyJointSupport, dbo.[IPACS-C-PipeSupport-JointHistory].JointState, dbo.[IPACS-C-PipeSupport-JointHistory].[Shop Front Order], dbo.[IPACS-C-PipeSupport-JointHistory].[SFO Date], dbo.[IPACS-C-PipeSupport-JointHistory].[Shop FitUp Report], dbo.[IPACS-C-PipeSupport-JointHistory].[SFR Date], dbo.[IPACS-C-PipeSupport-JointHistory].[Shop Weld Report], dbo.[IPACS-C-PipeSupport-JointHistory].[SWR Date], dbo.[IPACS-C-PipeSupport-JointHistory].[Erection Front Order], dbo.[IPACS-C-PipeSupport-JointHistory].[EFO Date], dbo.[IPACS-C-PipeSupport-JointHistory].[Erection FitUp Report], dbo.[IPACS-C-PipeSupport-JointHistory].[EFR Date], dbo.[IPACS-C-PipeSupport-JointHistory].[Erection Weld Report], dbo.[IPACS-C-PipeSupport-JointHistory].[EWR Date], dbo.[IPACS-C-PipeSupport-JointHistory].Remark FROM dbo.[IPACS-C-PipeSupport-JointHistory] INNER JOIN dbo.[IPACS-C-PipeSupport-TypeRawMaterialMTO View] ON dbo.[IPACS-C-PipeSupport-JointHistory].SupportType = dbo.[IPACS-C-PipeSupport-TypeRawMaterialMTO View].SupportType) AS T0 LEFT OUTER JOIN (SELECT CONVERT(nvarchar, [JH-ID]) + ' | ' + [Orginal Part Code] AS [Sub-Link], ID, [JH-ID], [Orginal Part Code], [Substituted Part Code], Lenght, Width, Qty, MsysIpacsLock, MsysIpacsCreatorUN, MsysIpacsServerAddDateTime FROM dbo.[IPACS-C-PipeSupport-PartSubstitute]) AS T1 ON T0.[Sub-Link] = T1.[Sub-Link]