Table1 CREATE TABLE [#ICT_Log_ScannedDocumentTransmission_Branch]( [ParentTblRowID] [int] NULL, [ApplTrackingNo] [varchar](20) NULL, [FileTypeCategory] [nvarchar](250) NULL, [Remarks] [nvarchar](250) NULL, [CreatedOn] datetime) GO INSERT [#ICT_Log_ScannedDocumentTransmission_Branch] ([ParentTblRowID], [ApplTrackingNo], [FileTypeCategory], [Remarks],[CreatedOn]) VALUES (10001, N'010001-11/08', N'A Scanned Document Newly upload By Branch', N'SUJATHA DOCUMENT UPLOADED','2023-10-01') INSERT [#ICT_Log_ScannedDocumentTransmission_Branch] ([ParentTblRowID], [ApplTrackingNo], [FileTypeCategory], [Remarks],[CreatedOn]) VALUES (10001, N'010001-11/08', N'A Scanned Document Re-upload By Branch', N'SUJATHA DOCUMENT UPLOADED','2023-10-03') GO INSERT [#ICT_Log_ScannedDocumentTransmission_Branch] ([ParentTblRowID], [ApplTrackingNo], [FileTypeCategory], [Remarks],[CreatedOn]) VALUES (10001, N'010001-11/08', N'A Scanned Document Re-upload By Branch', N'SUJATHA DOCUMENT FINAL','2023-10-04') GO INSERT [#ICT_Log_ScannedDocumentTransmission_Branch] ([ParentTblRowID], [ApplTrackingNo], [FileTypeCategory], [Remarks],[CreatedOn]) VALUES (10002, N'010002-44/21', N'A Scanned Document Newly upload By Branch', N'MASA DOCUMENT','2023-9-07') GO Table2 CREATE TABLE [#ICT_Log_ScannedDocumentTransmission_HO]( [ParentTblRowID] [int] NULL, [ApplTrackingNo] [varchar](20) NULL, [IsApproved] [int] NULL, [ApproveRejectCategory] [nvarchar](250) NULL, [ApproveRejectRemarks] [nvarchar](250) NULL, [CreatedOn] [datetime] NULL) GO INSERT [#ICT_Log_ScannedDocumentTransmission_HO] ([ParentTblRowID], [ApplTrackingNo], [IsApproved], [ApproveRejectCategory], [ApproveRejectRemarks],[CreatedOn]) VALUES (10001, N'010001-11/08', 2, N'Document Not Clear', N'CLAIM FORM SIGN SEAL MISSING', '2023-10-02') GO INSERT [#ICT_Log_ScannedDocumentTransmission_HO] ([ParentTblRowID], [ApplTrackingNo], [IsApproved], [ApproveRejectCategory], [ApproveRejectRemarks],[CreatedOn]) VALUES (10001, N'010001-11/08', 2, N'Top Page is Not Clear', N'Print Pages Not clear', '2023-10-04') GO INSERT [#ICT_Log_ScannedDocumentTransmission_HO] ([ParentTblRowID], [ApplTrackingNo], [IsApproved], [ApproveRejectCategory], [ApproveRejectRemarks],[CreatedOn]) VALUES (10001, N'010001-11/08', 1, N'All document fine', N'OKAY', '2023-10-05') GO ApplTrackingNo WorkLog 010001-11/08 Branch: UploadOn:01-OCT-2023, Comments:Newly upload By Branch HO: VerifiedOn:02-OCT-2023, Status: Rejected, Remarks: Document Not Clear - CLAIM FORM SIGN SEAL MISSING. | Branch: UploadOn:03-OCT-2023, Comments:Re-upload By Branch. HO: VerifiedOn:04-OCT-2023, Status: Rejected, Remarks: Top Page is Not Clear - Print Pages not clear | Branch: UploadOn:04-OCT-2023, Comments:Re-upload By Branch. HO: VerifiedOn:05- OCT-2023, Status: Approved, Remarks: All document fine | BranchUploadCycle:3 010002-44/21 Branch: UploadOn:07-SEP-2023, Comments:Newly upload By Branch HO: Work In-progress | BranchUploadCycle:1 Note: 1. Version: Microsoft SQL Server 2016 (SP1-CU15-GDR) (KB4505221) - 13.0.4604.0 (X64) 2. Expected result in Comma seperated with " | " for every records 3. By using ParentTblRowID column we can connect both tables 4. We can trim "A Scanned Document" in Table1 5. in Table 2, if IsApproved=1 Then take if as a approved, IsApproved=2 is Rejected