Hi,
This is my table and data
CREATE TABLE [dbo].[Inquiry_GL_BudgetComparison_001_Detail](
[Id] [int] IDENTITY(1,1) NOT NULL,
[Batch_Id] [uniqueidentifier] NULL,
[company_code] [smallint] NULL,
[MMonth] [smallint] NULL,
[MMonth_Name] [varchar](50) NULL,
[YYear] [int] NULL,
[ref1] [varchar](200) NULL,
[ref2] [varchar](200) NULL,
[level1_code] [int] NULL,
[level2_code] [varchar](50) NULL,
[gl_code] [varchar](50) NULL,
[trans_date] [datetime] NULL,
[descrp] [varchar](200) NULL,
[AG_Descrp] [varchar](200) NULL,
[GL_Descrp] [varchar](200) NULL,
[thisAmt] [decimal](16, 2) NULL,
[thisBalance] [decimal](16, 2) NULL,
CONSTRAINT [PK_Inquiry_GL_BudgetComparison_001_Detail] PRIMARY KEY CLUSTERED
(
[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET IDENTITY_INSERT [dbo].[Inquiry_GL_BudgetComparison_001_Detail] ON
GO
INSERT [dbo].[Inquiry_GL_BudgetComparison_001_Detail] ([Id], [Batch_Id], [company_code], [MMonth], [MMonth_Name], [YYear], [ref1], [ref2], [level1_code], [level2_code], [gl_code], [trans_date], [descrp], [AG_Descrp], [GL_Descrp], [thisAmt], [thisBalance]) VALUES (1, N'4ba6f5a8-066c-4a13-a559-42357cd3b40f', 0, 1, NULL, 2023, N'0000039780', N'00029881 ', 1104, N'01 ', N'0910', CAST(N'2023-01-11T00:00:00.000' AS DateTime), N'Item 11', N'Item 21', N'Item 31', CAST(6215.03 AS Decimal(16, 2)), CAST(0.00 AS Decimal(16, 2)))
GO
INSERT [dbo].[Inquiry_GL_BudgetComparison_001_Detail] ([Id], [Batch_Id], [company_code], [MMonth], [MMonth_Name], [YYear], [ref1], [ref2], [level1_code], [level2_code], [gl_code], [trans_date], [descrp], [AG_Descrp], [GL_Descrp], [thisAmt], [thisBalance]) VALUES (2, N'4ba6f5a8-066c-4a13-a559-42357cd3b40f', 0, 1, NULL, 2023, N'0000039821', N'00029883 ', 1104, N'01 ', N'0910', CAST(N'2023-01-11T00:00:00.000' AS DateTime), N'Item 12', N'Item 22', N'Item 32', CAST(149294.34 AS Decimal(16, 2)), CAST(0.00 AS Decimal(16, 2)))
GO
INSERT [dbo].[Inquiry_GL_BudgetComparison_001_Detail] ([Id], [Batch_Id], [company_code], [MMonth], [MMonth_Name], [YYear], [ref1], [ref2], [level1_code], [level2_code], [gl_code], [trans_date], [descrp], [AG_Descrp], [GL_Descrp], [thisAmt], [thisBalance]) VALUES (3, N'4ba6f5a8-066c-4a13-a559-42357cd3b40f', 0, 1, NULL, 2023, N'0000039833', N'TT23/5370 ', 1104, N'01 ', N'0910', CAST(N'2023-01-11T00:00:00.000' AS DateTime), N'Item 13', N'Item 23', N'Item 33', CAST(198778.89 AS Decimal(16, 2)), CAST(0.00 AS Decimal(16, 2)))
GO
INSERT [dbo].[Inquiry_GL_BudgetComparison_001_Detail] ([Id], [Batch_Id], [company_code], [MMonth], [MMonth_Name], [YYear], [ref1], [ref2], [level1_code], [level2_code], [gl_code], [trans_date], [descrp], [AG_Descrp], [GL_Descrp], [thisAmt], [thisBalance]) VALUES (4, N'4ba6f5a8-066c-4a13-a559-42357cd3b40f', 0, 1, NULL, 2023, N'0000039841', N'00029884 ', 1104, N'01 ', N'0910', CAST(N'2023-01-12T00:00:00.000' AS DateTime), N'Item 14', N'Item 24', N'Item 34', CAST(154159.96 AS Decimal(16, 2)), CAST(0.00 AS Decimal(16, 2)))
GO
INSERT [dbo].[Inquiry_GL_BudgetComparison_001_Detail] ([Id], [Batch_Id], [company_code], [MMonth], [MMonth_Name], [YYear], [ref1], [ref2], [level1_code], [level2_code], [gl_code], [trans_date], [descrp], [AG_Descrp], [GL_Descrp], [thisAmt], [thisBalance]) VALUES (5, N'4ba6f5a8-066c-4a13-a559-42357cd3b40f', 0, 1, NULL, 2023, N'0000039877', N'00029893 ', 1104, N'01 ', N'0910', CAST(N'2023-01-19T00:00:00.000' AS DateTime), N'Item 15', N'Item 25', N'Item 35', CAST(15000.00 AS Decimal(16, 2)), CAST(0.00 AS Decimal(16, 2)))
GO
INSERT [dbo].[Inquiry_GL_BudgetComparison_001_Detail] ([Id], [Batch_Id], [company_code], [MMonth], [MMonth_Name], [YYear], [ref1], [ref2], [level1_code], [level2_code], [gl_code], [trans_date], [descrp], [AG_Descrp], [GL_Descrp], [thisAmt], [thisBalance]) VALUES (6, N'4ba6f5a8-066c-4a13-a559-42357cd3b40f', 0, 1, NULL, 2023, N'70015082 ', N'BMMB063005', 1104, N'01 ', N'0910', CAST(N'2023-01-19T00:00:00.000' AS DateTime), N'Item 16', N'Item 26', N'Item 36', CAST(-13671.08 AS Decimal(16, 2)), CAST(0.00 AS Decimal(16, 2)))
GO
INSERT [dbo].[Inquiry_GL_BudgetComparison_001_Detail] ([Id], [Batch_Id], [company_code], [MMonth], [MMonth_Name], [YYear], [ref1], [ref2], [level1_code], [level2_code], [gl_code], [trans_date], [descrp], [AG_Descrp], [GL_Descrp], [thisAmt], [thisBalance]) VALUES (7, N'4ba6f5a8-066c-4a13-a559-42357cd3b40f', 0, 1, NULL, 2023, N'70015083 ', N'BMMB063006', 1104, N'01 ', N'0910', CAST(N'2023-01-19T00:00:00.000' AS DateTime), N'Item 17', N'Item 27', N'Item 37', CAST(-55297.68 AS Decimal(16, 2)), CAST(0.00 AS Decimal(16, 2)))
GO
INSERT [dbo].[Inquiry_GL_BudgetComparison_001_Detail] ([Id], [Batch_Id], [company_code], [MMonth], [MMonth_Name], [YYear], [ref1], [ref2], [level1_code], [level2_code], [gl_code], [trans_date], [descrp], [AG_Descrp], [GL_Descrp], [thisAmt], [thisBalance]) VALUES (8, N'4ba6f5a8-066c-4a13-a559-42357cd3b40f', 0, 1, NULL, 2023, N'0000039875', N'TT23/5384 ', 1104, N'01 ', N'0910', CAST(N'2023-01-26T00:00:00.000' AS DateTime), N'Item 18', N'Item 28', N'Item 38', CAST(333000.00 AS Decimal(16, 2)), CAST(0.00 AS Decimal(16, 2)))
GO
INSERT [dbo].[Inquiry_GL_BudgetComparison_001_Detail] ([Id], [Batch_Id], [company_code], [MMonth], [MMonth_Name], [YYear], [ref1], [ref2], [level1_code], [level2_code], [gl_code], [trans_date], [descrp], [AG_Descrp], [GL_Descrp], [thisAmt], [thisBalance]) VALUES (9, N'4ba6f5a8-066c-4a13-a559-42357cd3b40f', 0, 2, NULL, 2023, N'0000039924', N'00029925 ', 1104, N'01 ', N'0910', CAST(N'2023-02-02T00:00:00.000' AS DateTime), N'Item 19', N'Item 29', N'Item 39', CAST(1250.00 AS Decimal(16, 2)), CAST(0.00 AS Decimal(16, 2)))
GO
INSERT [dbo].[Inquiry_GL_BudgetComparison_001_Detail] ([Id], [Batch_Id], [company_code], [MMonth], [MMonth_Name], [YYear], [ref1], [ref2], [level1_code], [level2_code], [gl_code], [trans_date], [descrp], [AG_Descrp], [GL_Descrp], [thisAmt], [thisBalance]) VALUES (10, N'4ba6f5a8-066c-4a13-a559-42357cd3b40f', 0, 2, NULL, 2023, N'0000039906', N'TT23/5395 ', 1104, N'01 ', N'0910', CAST(N'2023-02-07T00:00:00.000' AS DateTime), N'Item 110', N'Item 210', N'Item 310', CAST(250000.00 AS Decimal(16, 2)), CAST(0.00 AS Decimal(16, 2)))
GO
INSERT [dbo].[Inquiry_GL_BudgetComparison_001_Detail] ([Id], [Batch_Id], [company_code], [MMonth], [MMonth_Name], [YYear], [ref1], [ref2], [level1_code], [level2_code], [gl_code], [trans_date], [descrp], [AG_Descrp], [GL_Descrp], [thisAmt], [thisBalance]) VALUES (11, N'4ba6f5a8-066c-4a13-a559-42357cd3b40f', 0, 2, NULL, 2023, N'0000039945', N'00029933 ', 1104, N'01 ', N'0910', CAST(N'2023-02-09T00:00:00.000' AS DateTime), N'Item 111', N'Item 211', N'Item 311', CAST(291.67 AS Decimal(16, 2)), CAST(0.00 AS Decimal(16, 2)))
GO
INSERT [dbo].[Inquiry_GL_BudgetComparison_001_Detail] ([Id], [Batch_Id], [company_code], [MMonth], [MMonth_Name], [YYear], [ref1], [ref2], [level1_code], [level2_code], [gl_code], [trans_date], [descrp], [AG_Descrp], [GL_Descrp], [thisAmt], [thisBalance]) VALUES (12, N'4ba6f5a8-066c-4a13-a559-42357cd3b40f', 0, 2, NULL, 2023, N'0000039934', N'TT23/5400 ', 1104, N'01 ', N'0910', CAST(N'2023-02-10T00:00:00.000' AS DateTime), N'Item 112', N'Item 212', N'Item 312', CAST(248926.24 AS Decimal(16, 2)), CAST(0.00 AS Decimal(16, 2)))
GO
INSERT [dbo].[Inquiry_GL_BudgetComparison_001_Detail] ([Id], [Batch_Id], [company_code], [MMonth], [MMonth_Name], [YYear], [ref1], [ref2], [level1_code], [level2_code], [gl_code], [trans_date], [descrp], [AG_Descrp], [GL_Descrp], [thisAmt], [thisBalance]) VALUES (13, N'4ba6f5a8-066c-4a13-a559-42357cd3b40f', 0, 2, NULL, 2023, N'0000039961', N'00029941 ', 1104, N'01 ', N'0910', CAST(N'2023-02-13T00:00:00.000' AS DateTime), N'Item 113', N'Item 213', N'Item 313', CAST(44845.09 AS Decimal(16, 2)), CAST(0.00 AS Decimal(16, 2)))
GO
INSERT [dbo].[Inquiry_GL_BudgetComparison_001_Detail] ([Id], [Batch_Id], [company_code], [MMonth], [MMonth_Name], [YYear], [ref1], [ref2], [level1_code], [level2_code], [gl_code], [trans_date], [descrp], [AG_Descrp], [GL_Descrp], [thisAmt], [thisBalance]) VALUES (14, N'4ba6f5a8-066c-4a13-a559-42357cd3b40f', 0, 2, NULL, 2023, N'0000039966', N'00029947 ', 1104, N'01 ', N'0910', CAST(N'2023-02-13T00:00:00.000' AS DateTime), N'Item 114', N'Item 214', N'Item 314', CAST(25600.00 AS Decimal(16, 2)), CAST(0.00 AS Decimal(16, 2)))
GO
INSERT [dbo].[Inquiry_GL_BudgetComparison_001_Detail] ([Id], [Batch_Id], [company_code], [MMonth], [MMonth_Name], [YYear], [ref1], [ref2], [level1_code], [level2_code], [gl_code], [trans_date], [descrp], [AG_Descrp], [GL_Descrp], [thisAmt], [thisBalance]) VALUES (15, N'4ba6f5a8-066c-4a13-a559-42357cd3b40f', 0, 2, NULL, 2023, N'0000039995', N'00029960 ', 1104, N'01 ', N'0910', CAST(N'2023-02-17T00:00:00.000' AS DateTime), N'Item 115', N'Item 215', N'Item 315', CAST(30546.68 AS Decimal(16, 2)), CAST(0.00 AS Decimal(16, 2)))
GO
INSERT [dbo].[Inquiry_GL_BudgetComparison_001_Detail] ([Id], [Batch_Id], [company_code], [MMonth], [MMonth_Name], [YYear], [ref1], [ref2], [level1_code], [level2_code], [gl_code], [trans_date], [descrp], [AG_Descrp], [GL_Descrp], [thisAmt], [thisBalance]) VALUES (16, N'4ba6f5a8-066c-4a13-a559-42357cd3b40f', 0, 2, NULL, 2023, N'0000039986', N'00029963 ', 1104, N'01 ', N'0910', CAST(N'2023-02-20T00:00:00.000' AS DateTime), N'Item 116', N'Item 216', N'Item 316', CAST(97390.86 AS Decimal(16, 2)), CAST(0.00 AS Decimal(16, 2)))
GO
INSERT [dbo].[Inquiry_GL_BudgetComparison_001_Detail] ([Id], [Batch_Id], [company_code], [MMonth], [MMonth_Name], [YYear], [ref1], [ref2], [level1_code], [level2_code], [gl_code], [trans_date], [descrp], [AG_Descrp], [GL_Descrp], [thisAmt], [thisBalance]) VALUES (17, N'4ba6f5a8-066c-4a13-a559-42357cd3b40f', 0, 2, NULL, 2023, N'0000040009', N'TT23/5420 ', 1104, N'01 ', N'0910', CAST(N'2023-02-22T00:00:00.000' AS DateTime), N'Item 117', N'Item 217', N'Item 317', CAST(363000.00 AS Decimal(16, 2)), CAST(0.00 AS Decimal(16, 2)))
GO
INSERT [dbo].[Inquiry_GL_BudgetComparison_001_Detail] ([Id], [Batch_Id], [company_code], [MMonth], [MMonth_Name], [YYear], [ref1], [ref2], [level1_code], [level2_code], [gl_code], [trans_date], [descrp], [AG_Descrp], [GL_Descrp], [thisAmt], [thisBalance]) VALUES (18, N'4ba6f5a8-066c-4a13-a559-42357cd3b40f', 0, 2, NULL, 2023, N'70015180 ', N'BMMB017329', 1104, N'01 ', N'0910', CAST(N'2023-02-23T00:00:00.000' AS DateTime), N'Item 118', N'Item 218', N'Item 318', CAST(-250.00 AS Decimal(16, 2)), CAST(0.00 AS Decimal(16, 2)))
GO
INSERT [dbo].[Inquiry_GL_BudgetComparison_001_Detail] ([Id], [Batch_Id], [company_code], [MMonth], [MMonth_Name], [YYear], [ref1], [ref2], [level1_code], [level2_code], [gl_code], [trans_date], [descrp], [AG_Descrp], [GL_Descrp], [thisAmt], [thisBalance]) VALUES (19, N'4ba6f5a8-066c-4a13-a559-42357cd3b40f', 0, 2, NULL, 2023, N'70015180 ', N'BMMB017329', 1104, N'01 ', N'0910', CAST(N'2023-02-23T00:00:00.000' AS DateTime), N'Item 119', N'Item 219', N'Item 319', CAST(-250.00 AS Decimal(16, 2)), CAST(0.00 AS Decimal(16, 2)))
GO
INSERT [dbo].[Inquiry_GL_BudgetComparison_001_Detail] ([Id], [Batch_Id], [company_code], [MMonth], [MMonth_Name], [YYear], [ref1], [ref2], [level1_code], [level2_code], [gl_code], [trans_date], [descrp], [AG_Descrp], [GL_Descrp], [thisAmt], [thisBalance]) VALUES (20, N'4ba6f5a8-066c-4a13-a559-42357cd3b40f', 0, 2, NULL, 2023, N'70015180 ', N'BMMB017329', 1104, N'01 ', N'0910', CAST(N'2023-02-23T00:00:00.000' AS DateTime), N'Item 120', N'Item 220', N'Item 320', CAST(-250.00 AS Decimal(16, 2)), CAST(0.00 AS Decimal(16, 2)))
GO
INSERT [dbo].[Inquiry_GL_BudgetComparison_001_Detail] ([Id], [Batch_Id], [company_code], [MMonth], [MMonth_Name], [YYear], [ref1], [ref2], [level1_code], [level2_code], [gl_code], [trans_date], [descrp], [AG_Descrp], [GL_Descrp], [thisAmt], [thisBalance]) VALUES (21, N'4ba6f5a8-066c-4a13-a559-42357cd3b40f', 0, 2, NULL, 2023, N'0000040032', N'00029983 ', 1104, N'01 ', N'0910', CAST(N'2023-02-23T00:00:00.000' AS DateTime), N'Item 121', N'Item 221', N'Item 321', CAST(4469.76 AS Decimal(16, 2)), CAST(0.00 AS Decimal(16, 2)))
GO
INSERT [dbo].[Inquiry_GL_BudgetComparison_001_Detail] ([Id], [Batch_Id], [company_code], [MMonth], [MMonth_Name], [YYear], [ref1], [ref2], [level1_code], [level2_code], [gl_code], [trans_date], [descrp], [AG_Descrp], [GL_Descrp], [thisAmt], [thisBalance]) VALUES (22, N'4ba6f5a8-066c-4a13-a559-42357cd3b40f', 0, 2, NULL, 2023, N'70015180 ', N'BMMB017329', 1104, N'01 ', N'0910', CAST(N'2023-02-23T00:00:00.000' AS DateTime), N'Item 122', N'Item 222', N'Item 322', CAST(-250.00 AS Decimal(16, 2)), CAST(0.00 AS Decimal(16, 2)))
GO
INSERT [dbo].[Inquiry_GL_BudgetComparison_001_Detail] ([Id], [Batch_Id], [company_code], [MMonth], [MMonth_Name], [YYear], [ref1], [ref2], [level1_code], [level2_code], [gl_code], [trans_date], [descrp], [AG_Descrp], [GL_Descrp], [thisAmt], [thisBalance]) VALUES (23, N'4ba6f5a8-066c-4a13-a559-42357cd3b40f', 0, 2, NULL, 2023, N'401902 ', N'JVHQ020019', 1104, N'01 ', N'0910', CAST(N'2023-02-28T00:00:00.000' AS DateTime), N'Item 123', N'Item 223', N'Item 323', CAST(120974.00 AS Decimal(16, 2)), CAST(0.00 AS Decimal(16, 2)))
GO
INSERT [dbo].[Inquiry_GL_BudgetComparison_001_Detail] ([Id], [Batch_Id], [company_code], [MMonth], [MMonth_Name], [YYear], [ref1], [ref2], [level1_code], [level2_code], [gl_code], [trans_date], [descrp], [AG_Descrp], [GL_Descrp], [thisAmt], [thisBalance]) VALUES (24, N'4ba6f5a8-066c-4a13-a559-42357cd3b40f', 0, 3, NULL, 2023, N'0000040053', N'00030000 ', 1104, N'01 ', N'0910', CAST(N'2023-03-02T00:00:00.000' AS DateTime), N'Item 124', N'Item 224', N'Item 324', CAST(900.00 AS Decimal(16, 2)), CAST(0.00 AS Decimal(16, 2)))
GO
INSERT [dbo].[Inquiry_GL_BudgetComparison_001_Detail] ([Id], [Batch_Id], [company_code], [MMonth], [MMonth_Name], [YYear], [ref1], [ref2], [level1_code], [level2_code], [gl_code], [trans_date], [descrp], [AG_Descrp], [GL_Descrp], [thisAmt], [thisBalance]) VALUES (25, N'4ba6f5a8-066c-4a13-a559-42357cd3b40f', 0, 3, NULL, 2023, N'0000040058', N'00030003 ', 1104, N'01 ', N'0910', CAST(N'2023-03-02T00:00:00.000' AS DateTime), N'Item 125', N'Item 225', N'Item 325', CAST(1488.24 AS Decimal(16, 2)), CAST(0.00 AS Decimal(16, 2)))
GO
INSERT [dbo].[Inquiry_GL_BudgetComparison_001_Detail] ([Id], [Batch_Id], [company_code], [MMonth], [MMonth_Name], [YYear], [ref1], [ref2], [level1_code], [level2_code], [gl_code], [trans_date], [descrp], [AG_Descrp], [GL_Descrp], [thisAmt], [thisBalance]) VALUES (26, N'4ba6f5a8-066c-4a13-a559-42357cd3b40f', 0, 3, NULL, 2023, N'0000040037', N'TT23/5421 ', 1104, N'01 ', N'0910', CAST(N'2023-03-03T00:00:00.000' AS DateTime), N'Item 126', N'Item 226', N'Item 326', CAST(250000.00 AS Decimal(16, 2)), CAST(0.00 AS Decimal(16, 2)))
GO
INSERT [dbo].[Inquiry_GL_BudgetComparison_001_Detail] ([Id], [Batch_Id], [company_code], [MMonth], [MMonth_Name], [YYear], [ref1], [ref2], [level1_code], [level2_code], [gl_code], [trans_date], [descrp], [AG_Descrp], [GL_Descrp], [thisAmt], [thisBalance]) VALUES (27, N'4ba6f5a8-066c-4a13-a559-42357cd3b40f', 0, 3, NULL, 2023, N'0000040070', N'00030010 ', 1104, N'01 ', N'0910', CAST(N'2023-03-06T00:00:00.000' AS DateTime), N'Item 127', N'Item 227', N'Item 327', CAST(148845.05 AS Decimal(16, 2)), CAST(0.00 AS Decimal(16, 2)))
GO
INSERT [dbo].[Inquiry_GL_BudgetComparison_001_Detail] ([Id], [Batch_Id], [company_code], [MMonth], [MMonth_Name], [YYear], [ref1], [ref2], [level1_code], [level2_code], [gl_code], [trans_date], [descrp], [AG_Descrp], [GL_Descrp], [thisAmt], [thisBalance]) VALUES (28, N'4ba6f5a8-066c-4a13-a559-42357cd3b40f', 0, 3, NULL, 2023, N'0000040086', N'00030017 ', 1104, N'01 ', N'0910', CAST(N'2023-03-09T00:00:00.000' AS DateTime), N'Item 128', N'Item 228', N'Item 328', CAST(82300.76 AS Decimal(16, 2)), CAST(0.00 AS Decimal(16, 2)))
GO
INSERT [dbo].[Inquiry_GL_BudgetComparison_001_Detail] ([Id], [Batch_Id], [company_code], [MMonth], [MMonth_Name], [YYear], [ref1], [ref2], [level1_code], [level2_code], [gl_code], [trans_date], [descrp], [AG_Descrp], [GL_Descrp], [thisAmt], [thisBalance]) VALUES (29, N'4ba6f5a8-066c-4a13-a559-42357cd3b40f', 0, 3, NULL, 2023, N'0000040102', N'00030020 ', 1104, N'01 ', N'0910', CAST(N'2023-03-09T00:00:00.000' AS DateTime), N'Item 129', N'Item 229', N'Item 329', CAST(1310.68 AS Decimal(16, 2)), CAST(0.00 AS Decimal(16, 2)))
GO
INSERT [dbo].[Inquiry_GL_BudgetComparison_001_Detail] ([Id], [Batch_Id], [company_code], [MMonth], [MMonth_Name], [YYear], [ref1], [ref2], [level1_code], [level2_code], [gl_code], [trans_date], [descrp], [AG_Descrp], [GL_Descrp], [thisAmt], [thisBalance]) VALUES (30, N'4ba6f5a8-066c-4a13-a559-42357cd3b40f', 0, 3, NULL, 2023, N'0000040103', N'00030021 ', 1104, N'01 ', N'0910', CAST(N'2023-03-09T00:00:00.000' AS DateTime), N'Item 130', N'Item 230', N'Item 330', CAST(2340.00 AS Decimal(16, 2)), CAST(0.00 AS Decimal(16, 2)))
GO
INSERT [dbo].[Inquiry_GL_BudgetComparison_001_Detail] ([Id], [Batch_Id], [company_code], [MMonth], [MMonth_Name], [YYear], [ref1], [ref2], [level1_code], [level2_code], [gl_code], [trans_date], [descrp], [AG_Descrp], [GL_Descrp], [thisAmt], [thisBalance]) VALUES (31, N'4ba6f5a8-066c-4a13-a559-42357cd3b40f', 0, 3, NULL, 2023, N'70015240 ', N'BMMB063291', 1104, N'01 ', N'0910', CAST(N'2023-03-13T00:00:00.000' AS DateTime), N'Item 131', N'Item 231', N'Item 331', CAST(-27342.12 AS Decimal(16, 2)), CAST(0.00 AS Decimal(16, 2)))
GO
INSERT [dbo].[Inquiry_GL_BudgetComparison_001_Detail] ([Id], [Batch_Id], [company_code], [MMonth], [MMonth_Name], [YYear], [ref1], [ref2], [level1_code], [level2_code], [gl_code], [trans_date], [descrp], [AG_Descrp], [GL_Descrp], [thisAmt], [thisBalance]) VALUES (32, N'4ba6f5a8-066c-4a13-a559-42357cd3b40f', 0, 3, NULL, 2023, N'0000040108', N'TT23/5439 ', 1104, N'01 ', N'0910', CAST(N'2023-03-15T00:00:00.000' AS DateTime), N'Item 132', N'Item 232', N'Item 332', CAST(247324.90 AS Decimal(16, 2)), CAST(0.00 AS Decimal(16, 2)))
GO
INSERT [dbo].[Inquiry_GL_BudgetComparison_001_Detail] ([Id], [Batch_Id], [company_code], [MMonth], [MMonth_Name], [YYear], [ref1], [ref2], [level1_code], [level2_code], [gl_code], [trans_date], [descrp], [AG_Descrp], [GL_Descrp], [thisAmt], [thisBalance]) VALUES (33, N'4ba6f5a8-066c-4a13-a559-42357cd3b40f', 0, 3, NULL, 2023, N'0000040117', N'00030024 ', 1104, N'01 ', N'0910', CAST(N'2023-03-15T00:00:00.000' AS DateTime), N'Item 133', N'Item 233', N'Item 333', CAST(119.26 AS Decimal(16, 2)), CAST(0.00 AS Decimal(16, 2)))
GO
INSERT [dbo].[Inquiry_GL_BudgetComparison_001_Detail] ([Id], [Batch_Id], [company_code], [MMonth], [MMonth_Name], [YYear], [ref1], [ref2], [level1_code], [level2_code], [gl_code], [trans_date], [descrp], [AG_Descrp], [GL_Descrp], [thisAmt], [thisBalance]) VALUES (34, N'4ba6f5a8-066c-4a13-a559-42357cd3b40f', 0, 3, NULL, 2023, N'0000040120', N'00030027 ', 1104, N'01 ', N'0910', CAST(N'2023-03-15T00:00:00.000' AS DateTime), N'Item 134', N'Item 234', N'Item 334', CAST(1032.44 AS Decimal(16, 2)), CAST(0.00 AS Decimal(16, 2)))
GO
INSERT [dbo].[Inquiry_GL_BudgetComparison_001_Detail] ([Id], [Batch_Id], [company_code], [MMonth], [MMonth_Name], [YYear], [ref1], [ref2], [level1_code], [level2_code], [gl_code], [trans_date], [descrp], [AG_Descrp], [GL_Descrp], [thisAmt], [thisBalance]) VALUES (35, N'4ba6f5a8-066c-4a13-a559-42357cd3b40f', 0, 3, NULL, 2023, N'0000040127', N'00030028 ', 1104, N'01 ', N'0910', CAST(N'2023-03-16T00:00:00.000' AS DateTime), N'Item 135', N'Item 235', N'Item 335', CAST(1030.32 AS Decimal(16, 2)), CAST(0.00 AS Decimal(16, 2)))
GO
INSERT [dbo].[Inquiry_GL_BudgetComparison_001_Detail] ([Id], [Batch_Id], [company_code], [MMonth], [MMonth_Name], [YYear], [ref1], [ref2], [level1_code], [level2_code], [gl_code], [trans_date], [descrp], [AG_Descrp], [GL_Descrp], [thisAmt], [thisBalance]) VALUES (36, N'4ba6f5a8-066c-4a13-a559-42357cd3b40f', 0, 3, NULL, 2023, N'0000040164', N'00030046 ', 1104, N'01 ', N'0910', CAST(N'2023-03-24T00:00:00.000' AS DateTime), N'Item 136', N'Item 236', N'Item 336', CAST(1055.76 AS Decimal(16, 2)), CAST(0.00 AS Decimal(16, 2)))
GO
INSERT [dbo].[Inquiry_GL_BudgetComparison_001_Detail] ([Id], [Batch_Id], [company_code], [MMonth], [MMonth_Name], [YYear], [ref1], [ref2], [level1_code], [level2_code], [gl_code], [trans_date], [descrp], [AG_Descrp], [GL_Descrp], [thisAmt], [thisBalance]) VALUES (37, N'4ba6f5a8-066c-4a13-a559-42357cd3b40f', 0, 3, NULL, 2023, N'0000040171', N'TT23/5454 ', 1104, N'01 ', N'0910', CAST(N'2023-03-24T00:00:00.000' AS DateTime), N'Item 137', N'Item 237', N'Item 337', CAST(133000.00 AS Decimal(16, 2)), CAST(0.00 AS Decimal(16, 2)))
GO
INSERT [dbo].[Inquiry_GL_BudgetComparison_001_Detail] ([Id], [Batch_Id], [company_code], [MMonth], [MMonth_Name], [YYear], [ref1], [ref2], [level1_code], [level2_code], [gl_code], [trans_date], [descrp], [AG_Descrp], [GL_Descrp], [thisAmt], [thisBalance]) VALUES (38, N'4ba6f5a8-066c-4a13-a559-42357cd3b40f', 0, 3, NULL, 2023, N'0000040163', N'00030050 ', 1104, N'01 ', N'0910', CAST(N'2023-03-27T00:00:00.000' AS DateTime), N'Item 138', N'Item 238', N'Item 338', CAST(107293.16 AS Decimal(16, 2)), CAST(0.00 AS Decimal(16, 2)))
GO
INSERT [dbo].[Inquiry_GL_BudgetComparison_001_Detail] ([Id], [Batch_Id], [company_code], [MMonth], [MMonth_Name], [YYear], [ref1], [ref2], [level1_code], [level2_code], [gl_code], [trans_date], [descrp], [AG_Descrp], [GL_Descrp], [thisAmt], [thisBalance]) VALUES (39, N'4ba6f5a8-066c-4a13-a559-42357cd3b40f', 0, 3, NULL, 2023, N'0000040179', N'00030051 ', 1104, N'01 ', N'0910', CAST(N'2023-03-28T00:00:00.000' AS DateTime), N'Item 139', N'Item 239', N'Item 339', CAST(67.65 AS Decimal(16, 2)), CAST(0.00 AS Decimal(16, 2)))
GO
INSERT [dbo].[Inquiry_GL_BudgetComparison_001_Detail] ([Id], [Batch_Id], [company_code], [MMonth], [MMonth_Name], [YYear], [ref1], [ref2], [level1_code], [level2_code], [gl_code], [trans_date], [descrp], [AG_Descrp], [GL_Descrp], [thisAmt], [thisBalance]) VALUES (40, N'4ba6f5a8-066c-4a13-a559-42357cd3b40f', 0, 3, NULL, 2023, N'401203 ', N'JVHQ030012', 1104, N'01 ', N'0910', CAST(N'2023-03-31T00:00:00.000' AS DateTime), N'Item 140', N'Item 240', N'Item 340', CAST(13949.60 AS Decimal(16, 2)), CAST(0.00 AS Decimal(16, 2)))
GO
INSERT [dbo].[Inquiry_GL_BudgetComparison_001_Detail] ([Id], [Batch_Id], [company_code], [MMonth], [MMonth_Name], [YYear], [ref1], [ref2], [level1_code], [level2_code], [gl_code], [trans_date], [descrp], [AG_Descrp], [GL_Descrp], [thisAmt], [thisBalance]) VALUES (41, N'4ba6f5a8-066c-4a13-a559-42357cd3b40f', 0, 3, NULL, 2023, N'402803 ', N'JVHQ030028', 1104, N'01 ', N'0910', CAST(N'2023-03-31T00:00:00.000' AS DateTime), N'Item 141', N'Item 241', N'Item 341', CAST(352486.00 AS Decimal(16, 2)), CAST(0.00 AS Decimal(16, 2)))
GO
INSERT [dbo].[Inquiry_GL_BudgetComparison_001_Detail] ([Id], [Batch_Id], [company_code], [MMonth], [MMonth_Name], [YYear], [ref1], [ref2], [level1_code], [level2_code], [gl_code], [trans_date], [descrp], [AG_Descrp], [GL_Descrp], [thisAmt], [thisBalance]) VALUES (42, N'4ba6f5a8-066c-4a13-a559-42357cd3b40f', 0, 4, NULL, 2023, N'0000040168', N'TT23/5463 ', 1104, N'01 ', N'0910', CAST(N'2023-04-04T00:00:00.000' AS DateTime), N'Item 142', N'Item 242', N'Item 342', CAST(250000.00 AS Decimal(16, 2)), CAST(0.00 AS Decimal(16, 2)))
GO
INSERT [dbo].[Inquiry_GL_BudgetComparison_001_Detail] ([Id], [Batch_Id], [company_code], [MMonth], [MMonth_Name], [YYear], [ref1], [ref2], [level1_code], [level2_code], [gl_code], [trans_date], [descrp], [AG_Descrp], [GL_Descrp], [thisAmt], [thisBalance]) VALUES (43, N'4ba6f5a8-066c-4a13-a559-42357cd3b40f', 0, 4, NULL, 2023, N'0000040196', N'00030062 ', 1104, N'01 ', N'0910', CAST(N'2023-04-04T00:00:00.000' AS DateTime), N'Item 143', N'Item 243', N'Item 343', CAST(300.00 AS Decimal(16, 2)), CAST(0.00 AS Decimal(16, 2)))
GO
INSERT [dbo].[Inquiry_GL_BudgetComparison_001_Detail] ([Id], [Batch_Id], [company_code], [MMonth], [MMonth_Name], [YYear], [ref1], [ref2], [level1_code], [level2_code], [gl_code], [trans_date], [descrp], [AG_Descrp], [GL_Descrp], [thisAmt], [thisBalance]) VALUES (44, N'4ba6f5a8-066c-4a13-a559-42357cd3b40f', 0, 4, NULL, 2023, N'0000040226', N'00030083 ', 1104, N'01 ', N'0910', CAST(N'2023-04-10T00:00:00.000' AS DateTime), N'Item 144', N'Item 244', N'Item 344', CAST(4000.00 AS Decimal(16, 2)), CAST(0.00 AS Decimal(16, 2)))
GO
INSERT [dbo].[Inquiry_GL_BudgetComparison_001_Detail] ([Id], [Batch_Id], [company_code], [MMonth], [MMonth_Name], [YYear], [ref1], [ref2], [level1_code], [level2_code], [gl_code], [trans_date], [descrp], [AG_Descrp], [GL_Descrp], [thisAmt], [thisBalance]) VALUES (45, N'4ba6f5a8-066c-4a13-a559-42357cd3b40f', 0, 4, NULL, 2023, N'0000040246', N'00030088 ', 1104, N'01 ', N'0910', CAST(N'2023-04-11T00:00:00.000' AS DateTime), N'Item 145', N'Item 245', N'Item 345', CAST(97852.64 AS Decimal(16, 2)), CAST(0.00 AS Decimal(16, 2)))
GO
INSERT [dbo].[Inquiry_GL_BudgetComparison_001_Detail] ([Id], [Batch_Id], [company_code], [MMonth], [MMonth_Name], [YYear], [ref1], [ref2], [level1_code], [level2_code], [gl_code], [trans_date], [descrp], [AG_Descrp], [GL_Descrp], [thisAmt], [thisBalance]) VALUES (46, N'4ba6f5a8-066c-4a13-a559-42357cd3b40f', 0, 4, NULL, 2023, N'0000040253', N'00030094 ', 1104, N'01 ', N'0910', CAST(N'2023-04-12T00:00:00.000' AS DateTime), N'Item 146', N'Item 246', N'Item 346', CAST(5918.25 AS Decimal(16, 2)), CAST(0.00 AS Decimal(16, 2)))
GO
INSERT [dbo].[Inquiry_GL_BudgetComparison_001_Detail] ([Id], [Batch_Id], [company_code], [MMonth], [MMonth_Name], [YYear], [ref1], [ref2], [level1_code], [level2_code], [gl_code], [trans_date], [descrp], [AG_Descrp], [GL_Descrp], [thisAmt], [thisBalance]) VALUES (47, N'4ba6f5a8-066c-4a13-a559-42357cd3b40f', 0, 4, NULL, 2023, N'0000040253', N'00030094 ', 1104, N'01 ', N'0910', CAST(N'2023-04-12T00:00:00.000' AS DateTime), N'Item 147', N'Item 247', N'Item 347', CAST(17360.20 AS Decimal(16, 2)), CAST(0.00 AS Decimal(16, 2)))
GO
INSERT [dbo].[Inquiry_GL_BudgetComparison_001_Detail] ([Id], [Batch_Id], [company_code], [MMonth], [MMonth_Name], [YYear], [ref1], [ref2], [level1_code], [level2_code], [gl_code], [trans_date], [descrp], [AG_Descrp], [GL_Descrp], [thisAmt], [thisBalance]) VALUES (48, N'4ba6f5a8-066c-4a13-a559-42357cd3b40f', 0, 4, NULL, 2023, N'0000040260', N'TT23/5480 ', 1104, N'01 ', N'0910', CAST(N'2023-04-14T00:00:00.000' AS DateTime), N'Item 148', N'Item 248', N'Item 348', CAST(241408.35 AS Decimal(16, 2)), CAST(0.00 AS Decimal(16, 2)))
GO
INSERT [dbo].[Inquiry_GL_BudgetComparison_001_Detail] ([Id], [Batch_Id], [company_code], [MMonth], [MMonth_Name], [YYear], [ref1], [ref2], [level1_code], [level2_code], [gl_code], [trans_date], [descrp], [AG_Descrp], [GL_Descrp], [thisAmt], [thisBalance]) VALUES (49, N'4ba6f5a8-066c-4a13-a559-42357cd3b40f', 0, 4, NULL, 2023, N'0000040311', N'TT23/5489 ', 1104, N'01 ', N'0910', CAST(N'2023-04-27T00:00:00.000' AS DateTime), N'Item 149', N'Item 249', N'Item 349', CAST(124000.00 AS Decimal(16, 2)), CAST(0.00 AS Decimal(16, 2)))
GO
INSERT [dbo].[Inquiry_GL_BudgetComparison_001_Detail] ([Id], [Batch_Id], [company_code], [MMonth], [MMonth_Name], [YYear], [ref1], [ref2], [level1_code], [level2_code], [gl_code], [trans_date], [descrp], [AG_Descrp], [GL_Descrp], [thisAmt], [thisBalance]) VALUES (50, N'4ba6f5a8-066c-4a13-a559-42357cd3b40f', 0, 4, NULL, 2023, N'405604 ', N'JVHQ040056', 1104, N'01 ', N'0910', CAST(N'2023-04-30T00:00:00.000' AS DateTime), N'Item 150', N'Item 250', N'Item 350', CAST(65960.00 AS Decimal(16, 2)), CAST(0.00 AS Decimal(16, 2)))
GO
INSERT [dbo].[Inquiry_GL_BudgetComparison_001_Detail] ([Id], [Batch_Id], [company_code], [MMonth], [MMonth_Name], [YYear], [ref1], [ref2], [level1_code], [level2_code], [gl_code], [trans_date], [descrp], [AG_Descrp], [GL_Descrp], [thisAmt], [thisBalance]) VALUES (51, N'4ba6f5a8-066c-4a13-a559-42357cd3b40f', 0, 5, NULL, 2023, N'0000040302', N'TT23/5493 ', 1104, N'01 ', N'0910', CAST(N'2023-05-05T00:00:00.000' AS DateTime), N'Item 151', N'Item 251', N'Item 351', CAST(250000.00 AS Decimal(16, 2)), CAST(0.00 AS Decimal(16, 2)))
GO
INSERT [dbo].[Inquiry_GL_BudgetComparison_001_Detail] ([Id], [Batch_Id], [company_code], [MMonth], [MMonth_Name], [YYear], [ref1], [ref2], [level1_code], [level2_code], [gl_code], [trans_date], [descrp], [AG_Descrp], [GL_Descrp], [thisAmt], [thisBalance]) VALUES (52, N'4ba6f5a8-066c-4a13-a559-42357cd3b40f', 0, 5, NULL, 2023, N'0000040321', N'00030123 ', 1104, N'01 ', N'0910', CAST(N'2023-05-05T00:00:00.000' AS DateTime), N'Item 152', N'Item 252', N'Item 352', CAST(3604.00 AS Decimal(16, 2)), CAST(0.00 AS Decimal(16, 2)))
GO
INSERT [dbo].[Inquiry_GL_BudgetComparison_001_Detail] ([Id], [Batch_Id], [company_code], [MMonth], [MMonth_Name], [YYear], [ref1], [ref2], [level1_code], [level2_code], [gl_code], [trans_date], [descrp], [AG_Descrp], [GL_Descrp], [thisAmt], [thisBalance]) VALUES (53, N'4ba6f5a8-066c-4a13-a559-42357cd3b40f', 0, 5, NULL, 2023, N'0000040334', N'TT23/5498 ', 1104, N'01 ', N'0910', CAST(N'2023-05-09T00:00:00.000' AS DateTime), N'Item 153', N'Item 253', N'Item 353', CAST(505025.00 AS Decimal(16, 2)), CAST(0.00 AS Decimal(16, 2)))
GO
INSERT [dbo].[Inquiry_GL_BudgetComparison_001_Detail] ([Id], [Batch_Id], [company_code], [MMonth], [MMonth_Name], [YYear], [ref1], [ref2], [level1_code], [level2_code], [gl_code], [trans_date], [descrp], [AG_Descrp], [GL_Descrp], [thisAmt], [thisBalance]) VALUES (54, N'4ba6f5a8-066c-4a13-a559-42357cd3b40f', 0, 5, NULL, 2023, N'0000040361', N'00030138 ', 1104, N'01 ', N'0910', CAST(N'2023-05-15T00:00:00.000' AS DateTime), N'Item 154', N'Item 254', N'Item 354', CAST(95817.13 AS Decimal(16, 2)), CAST(0.00 AS Decimal(16, 2)))
GO
INSERT [dbo].[Inquiry_GL_BudgetComparison_001_Detail] ([Id], [Batch_Id], [company_code], [MMonth], [MMonth_Name], [YYear], [ref1], [ref2], [level1_code], [level2_code], [gl_code], [trans_date], [descrp], [AG_Descrp], [GL_Descrp], [thisAmt], [thisBalance]) VALUES (55, N'4ba6f5a8-066c-4a13-a559-42357cd3b40f', 0, 5, NULL, 2023, N'0000040364', N'00030139 ', 1104, N'01 ', N'0910', CAST(N'2023-05-15T00:00:00.000' AS DateTime), N'Item 155', N'Item 255', N'Item 355', CAST(83112.11 AS Decimal(16, 2)), CAST(0.00 AS Decimal(16, 2)))
GO
INSERT [dbo].[Inquiry_GL_BudgetComparison_001_Detail] ([Id], [Batch_Id], [company_code], [MMonth], [MMonth_Name], [YYear], [ref1], [ref2], [level1_code], [level2_code], [gl_code], [trans_date], [descrp], [AG_Descrp], [GL_Descrp], [thisAmt], [thisBalance]) VALUES (56, N'4ba6f5a8-066c-4a13-a559-42357cd3b40f', 0, 5, NULL, 2023, N'70015392 ', N'BMMB063674', 1104, N'01 ', N'0910', CAST(N'2023-05-18T00:00:00.000' AS DateTime), N'Item 156', N'Item 256', N'Item 356', CAST(-24183.12 AS Decimal(16, 2)), CAST(0.00 AS Decimal(16, 2)))
GO
INSERT [dbo].[Inquiry_GL_BudgetComparison_001_Detail] ([Id], [Batch_Id], [company_code], [MMonth], [MMonth_Name], [YYear], [ref1], [ref2], [level1_code], [level2_code], [gl_code], [trans_date], [descrp], [AG_Descrp], [GL_Descrp], [thisAmt], [thisBalance]) VALUES (57, N'4ba6f5a8-066c-4a13-a559-42357cd3b40f', 0, 6, NULL, 2023, N'1800436 ', N'0021183 ', 1104, N'01 ', N'0910', CAST(N'2023-05-23T00:00:00.000' AS DateTime), N'Item 157', N'Item 257', N'Item 357', CAST(8472.00 AS Decimal(16, 2)), CAST(0.00 AS Decimal(16, 2)))
GO
INSERT [dbo].[Inquiry_GL_BudgetComparison_001_Detail] ([Id], [Batch_Id], [company_code], [MMonth], [MMonth_Name], [YYear], [ref1], [ref2], [level1_code], [level2_code], [gl_code], [trans_date], [descrp], [AG_Descrp], [GL_Descrp], [thisAmt], [thisBalance]) VALUES (58, N'4ba6f5a8-066c-4a13-a559-42357cd3b40f', 0, 5, NULL, 2023, N'0000040389', N'TT23/5515 ', 1104, N'01 ', N'0910', CAST(N'2023-05-26T00:00:00.000' AS DateTime), N'Item 158', N'Item 258', N'Item 358', CAST(247429.70 AS Decimal(16, 2)), CAST(0.00 AS Decimal(16, 2)))
GO
INSERT [dbo].[Inquiry_GL_BudgetComparison_001_Detail] ([Id], [Batch_Id], [company_code], [MMonth], [MMonth_Name], [YYear], [ref1], [ref2], [level1_code], [level2_code], [gl_code], [trans_date], [descrp], [AG_Descrp], [GL_Descrp], [thisAmt], [thisBalance]) VALUES (59, N'4ba6f5a8-066c-4a13-a559-42357cd3b40f', 0, 5, NULL, 2023, N'400405 ', N'JVHQ050004', 1104, N'01 ', N'0910', CAST(N'2023-05-31T00:00:00.000' AS DateTime), N'Item 159', N'Item 259', N'Item 359', CAST(2120.00 AS Decimal(16, 2)), CAST(0.00 AS Decimal(16, 2)))
GO
INSERT [dbo].[Inquiry_GL_BudgetComparison_001_Detail] ([Id], [Batch_Id], [company_code], [MMonth], [MMonth_Name], [YYear], [ref1], [ref2], [level1_code], [level2_code], [gl_code], [trans_date], [descrp], [AG_Descrp], [GL_Descrp], [thisAmt], [thisBalance]) VALUES (60, N'4ba6f5a8-066c-4a13-a559-42357cd3b40f', 0, 5, NULL, 2023, N'400305 ', N'JVHQ050003', 1104, N'01 ', N'0910', CAST(N'2023-05-31T00:00:00.000' AS DateTime), N'Item 160', N'Item 260', N'Item 360', CAST(16408.80 AS Decimal(16, 2)), CAST(0.00 AS Decimal(16, 2)))
GO
INSERT [dbo].[Inquiry_GL_BudgetComparison_001_Detail] ([Id], [Batch_Id], [company_code], [MMonth], [MMonth_Name], [YYear], [ref1], [ref2], [level1_code], [level2_code], [gl_code], [trans_date], [descrp], [AG_Descrp], [GL_Descrp], [thisAmt], [thisBalance]) VALUES (61, N'4ba6f5a8-066c-4a13-a559-42357cd3b40f', 0, 5, NULL, 2023, N'401205 ', N'JVHQ050012', 1104, N'01 ', N'0910', CAST(N'2023-05-31T00:00:00.000' AS DateTime), N'Item 161', N'Item 261', N'Item 361', CAST(263064.00 AS Decimal(16, 2)), CAST(0.00 AS Decimal(16, 2)))
GO
INSERT [dbo].[Inquiry_GL_BudgetComparison_001_Detail] ([Id], [Batch_Id], [company_code], [MMonth], [MMonth_Name], [YYear], [ref1], [ref2], [level1_code], [level2_code], [gl_code], [trans_date], [descrp], [AG_Descrp], [GL_Descrp], [thisAmt], [thisBalance]) VALUES (62, N'4ba6f5a8-066c-4a13-a559-42357cd3b40f', 0, 6, NULL, 2023, N'0000040406', N'TT23/5521 ', 1104, N'01 ', N'0910', CAST(N'2023-06-02T00:00:00.000' AS DateTime), N'Item 162', N'Item 262', N'Item 362', CAST(250000.00 AS Decimal(16, 2)), CAST(0.00 AS Decimal(16, 2)))
GO
INSERT [dbo].[Inquiry_GL_BudgetComparison_001_Detail] ([Id], [Batch_Id], [company_code], [MMonth], [MMonth_Name], [YYear], [ref1], [ref2], [level1_code], [level2_code], [gl_code], [trans_date], [descrp], [AG_Descrp], [GL_Descrp], [thisAmt], [thisBalance]) VALUES (63, N'4ba6f5a8-066c-4a13-a559-42357cd3b40f', 0, 6, NULL, 2023, N'0000040470', N'00030184 ', 1104, N'01 ', N'0910', CAST(N'2023-06-09T00:00:00.000' AS DateTime), N'Item 163', N'Item 263', N'Item 363', CAST(76693.29 AS Decimal(16, 2)), CAST(0.00 AS Decimal(16, 2)))
GO
INSERT [dbo].[Inquiry_GL_BudgetComparison_001_Detail] ([Id], [Batch_Id], [company_code], [MMonth], [MMonth_Name], [YYear], [ref1], [ref2], [level1_code], [level2_code], [gl_code], [trans_date], [descrp], [AG_Descrp], [GL_Descrp], [thisAmt], [thisBalance]) VALUES (64, N'4ba6f5a8-066c-4a13-a559-42357cd3b40f', 0, 6, NULL, 2023, N'0000040478', N'00030192 ', 1104, N'01 ', N'0910', CAST(N'2023-06-12T00:00:00.000' AS DateTime), N'Item 164', N'Item 264', N'Item 364', CAST(54222.00 AS Decimal(16, 2)), CAST(0.00 AS Decimal(16, 2)))
GO
INSERT [dbo].[Inquiry_GL_BudgetComparison_001_Detail] ([Id], [Batch_Id], [company_code], [MMonth], [MMonth_Name], [YYear], [ref1], [ref2], [level1_code], [level2_code], [gl_code], [trans_date], [descrp], [AG_Descrp], [GL_Descrp], [thisAmt], [thisBalance]) VALUES (65, N'4ba6f5a8-066c-4a13-a559-42357cd3b40f', 0, 6, NULL, 2023, N'401306 ', N'JVHQ060013', 1104, N'01 ', N'0910', CAST(N'2023-06-30T00:00:00.000' AS DateTime), N'Item 165', N'Item 265', N'Item 365', CAST(151320.00 AS Decimal(16, 2)), CAST(0.00 AS Decimal(16, 2)))
GO
INSERT [dbo].[Inquiry_GL_BudgetComparison_001_Detail] ([Id], [Batch_Id], [company_code], [MMonth], [MMonth_Name], [YYear], [ref1], [ref2], [level1_code], [level2_code], [gl_code], [trans_date], [descrp], [AG_Descrp], [GL_Descrp], [thisAmt], [thisBalance]) VALUES (66, N'4ba6f5a8-066c-4a13-a559-42357cd3b40f', 0, 7, NULL, 2023, N'0000040525', N'TT23/5554 ', 1104, N'01 ', N'0910', CAST(N'2023-07-06T00:00:00.000' AS DateTime), N'Item 166', N'Item 266', N'Item 366', CAST(250000.00 AS Decimal(16, 2)), CAST(0.00 AS Decimal(16, 2)))
GO
INSERT [dbo].[Inquiry_GL_BudgetComparison_001_Detail] ([Id], [Batch_Id], [company_code], [MMonth], [MMonth_Name], [YYear], [ref1], [ref2], [level1_code], [level2_code], [gl_code], [trans_date], [descrp], [AG_Descrp], [GL_Descrp], [thisAmt], [thisBalance]) VALUES (67, N'4ba6f5a8-066c-4a13-a559-42357cd3b40f', 0, 7, NULL, 2023, N'0000040584', N'00030231 ', 1104, N'01 ', N'0910', CAST(N'2023-07-10T00:00:00.000' AS DateTime), N'Item 167', N'Item 267', N'Item 367', CAST(55500.01 AS Decimal(16, 2)), CAST(0.00 AS Decimal(16, 2)))
GO
INSERT [dbo].[Inquiry_GL_BudgetComparison_001_Detail] ([Id], [Batch_Id], [company_code], [MMonth], [MMonth_Name], [YYear], [ref1], [ref2], [level1_code], [level2_code], [gl_code], [trans_date], [descrp], [AG_Descrp], [GL_Descrp], [thisAmt], [thisBalance]) VALUES (68, N'4ba6f5a8-066c-4a13-a559-42357cd3b40f', 0, 7, NULL, 2023, N'0000040602', N'00030247 ', 1104, N'01 ', N'0910', CAST(N'2023-07-18T00:00:00.000' AS DateTime), N'Item 168', N'Item 268', N'Item 368', CAST(2162.40 AS Decimal(16, 2)), CAST(0.00 AS Decimal(16, 2)))
GO
INSERT [dbo].[Inquiry_GL_BudgetComparison_001_Detail] ([Id], [Batch_Id], [company_code], [MMonth], [MMonth_Name], [YYear], [ref1], [ref2], [level1_code], [level2_code], [gl_code], [trans_date], [descrp], [AG_Descrp], [GL_Descrp], [thisAmt], [thisBalance]) VALUES (69, N'4ba6f5a8-066c-4a13-a559-42357cd3b40f', 0, 7, NULL, 2023, N'0000040603', N'00030248 ', 1104, N'01 ', N'0910', CAST(N'2023-07-18T00:00:00.000' AS DateTime), N'Item 169', N'Item 269', N'Item 369', CAST(1068.48 AS Decimal(16, 2)), CAST(0.00 AS Decimal(16, 2)))
GO
INSERT [dbo].[Inquiry_GL_BudgetComparison_001_Detail] ([Id], [Batch_Id], [company_code], [MMonth], [MMonth_Name], [YYear], [ref1], [ref2], [level1_code], [level2_code], [gl_code], [trans_date], [descrp], [AG_Descrp], [GL_Descrp], [thisAmt], [thisBalance]) VALUES (70, N'4ba6f5a8-066c-4a13-a559-42357cd3b40f', 0, 7, NULL, 2023, N'0000040601', N'00030259 ', 1104, N'01 ', N'0910', CAST(N'2023-07-18T00:00:00.000' AS DateTime), N'Item 170', N'Item 270', N'Item 370', CAST(1057.88 AS Decimal(16, 2)), CAST(0.00 AS Decimal(16, 2)))
GO
INSERT [dbo].[Inquiry_GL_BudgetComparison_001_Detail] ([Id], [Batch_Id], [company_code], [MMonth], [MMonth_Name], [YYear], [ref1], [ref2], [level1_code], [level2_code], [gl_code], [trans_date], [descrp], [AG_Descrp], [GL_Descrp], [thisAmt], [thisBalance]) VALUES (71, N'4ba6f5a8-066c-4a13-a559-42357cd3b40f', 0, 7, NULL, 2023, N'0000040614', N'00030253 ', 1104, N'01 ', N'0910', CAST(N'2023-07-18T00:00:00.000' AS DateTime), N'Item 171', N'Item 271', N'Item 371', CAST(32406.57 AS Decimal(16, 2)), CAST(0.00 AS Decimal(16, 2)))
GO
INSERT [dbo].[Inquiry_GL_BudgetComparison_001_Detail] ([Id], [Batch_Id], [company_code], [MMonth], [MMonth_Name], [YYear], [ref1], [ref2], [level1_code], [level2_code], [gl_code], [trans_date], [descrp], [AG_Descrp], [GL_Descrp], [thisAmt], [thisBalance]) VALUES (72, N'4ba6f5a8-066c-4a13-a559-42357cd3b40f', 0, 7, NULL, 2023, N'0000040618', N'00030254 ', 1104, N'01 ', N'0910', CAST(N'2023-07-18T00:00:00.000' AS DateTime), N'Item 172', N'Item 272', N'Item 372', CAST(4000.00 AS Decimal(16, 2)), CAST(0.00 AS Decimal(16, 2)))
GO
INSERT [dbo].[Inquiry_GL_BudgetComparison_001_Detail] ([Id], [Batch_Id], [company_code], [MMonth], [MMonth_Name], [YYear], [ref1], [ref2], [level1_code], [level2_code], [gl_code], [trans_date], [descrp], [AG_Descrp], [GL_Descrp], [thisAmt], [thisBalance]) VALUES (73, N'4ba6f5a8-066c-4a13-a559-42357cd3b40f', 0, 7, NULL, 2023, N'0000040542', N'00030267 ', 1104, N'01 ', N'0910', CAST(N'2023-07-21T00:00:00.000' AS DateTime), N'Item 173', N'Item 273', N'Item 373', CAST(223000.00 AS Decimal(16, 2)), CAST(0.00 AS Decimal(16, 2)))
GO
INSERT [dbo].[Inquiry_GL_BudgetComparison_001_Detail] ([Id], [Batch_Id], [company_code], [MMonth], [MMonth_Name], [YYear], [ref1], [ref2], [level1_code], [level2_code], [gl_code], [trans_date], [descrp], [AG_Descrp], [GL_Descrp], [thisAmt], [thisBalance]) VALUES (74, N'4ba6f5a8-066c-4a13-a559-42357cd3b40f', 0, 7, NULL, 2023, N'0000040611', N'TT23/5575 ', 1104, N'01 ', N'0910', CAST(N'2023-07-21T00:00:00.000' AS DateTime), N'Item 174', N'Item 274', N'Item 374', CAST(243880.00 AS Decimal(16, 2)), CAST(0.00 AS Decimal(16, 2)))
GO
INSERT [dbo].[Inquiry_GL_BudgetComparison_001_Detail] ([Id], [Batch_Id], [company_code], [MMonth], [MMonth_Name], [YYear], [ref1], [ref2], [level1_code], [level2_code], [gl_code], [trans_date], [descrp], [AG_Descrp], [GL_Descrp], [thisAmt], [thisBalance]) VALUES (75, N'4ba6f5a8-066c-4a13-a559-42357cd3b40f', 0, 7, NULL, 2023, N'0000040632', N'00030264 ', 1104, N'01 ', N'0910', CAST(N'2023-07-21T00:00:00.000' AS DateTime), N'Item 175', N'Item 275', N'Item 375', CAST(3486.69 AS Decimal(16, 2)), CAST(0.00 AS Decimal(16, 2)))
GO
INSERT [dbo].[Inquiry_GL_BudgetComparison_001_Detail] ([Id], [Batch_Id], [company_code], [MMonth], [MMonth_Name], [YYear], [ref1], [ref2], [level1_code], [level2_code], [gl_code], [trans_date], [descrp], [AG_Descrp], [GL_Descrp], [thisAmt], [thisBalance]) VALUES (76, N'4ba6f5a8-066c-4a13-a559-42357cd3b40f', 0, 7, NULL, 2023, N'1800564 ', N'0021374 ', 1104, N'01 ', N'0910', CAST(N'2023-07-25T00:00:00.000' AS DateTime), N'Item 176', N'Item 276', N'Item 376', CAST(685800.00 AS Decimal(16, 2)), CAST(0.00 AS Decimal(16, 2)))
GO
INSERT [dbo].[Inquiry_GL_BudgetComparison_001_Detail] ([Id], [Batch_Id], [company_code], [MMonth], [MMonth_Name], [YYear], [ref1], [ref2], [level1_code], [level2_code], [gl_code], [trans_date], [descrp], [AG_Descrp], [GL_Descrp], [thisAmt], [thisBalance]) VALUES (77, N'4ba6f5a8-066c-4a13-a559-42357cd3b40f', 0, 7, NULL, 2023, N'70015510 ', N'BMMB064143', 1104, N'01 ', N'0910', CAST(N'2023-07-25T00:00:00.000' AS DateTime), N'Item 177', N'Item 277', N'Item 377', CAST(-12543.93 AS Decimal(16, 2)), CAST(0.00 AS Decimal(16, 2)))
GO
INSERT [dbo].[Inquiry_GL_BudgetComparison_001_Detail] ([Id], [Batch_Id], [company_code], [MMonth], [MMonth_Name], [YYear], [ref1], [ref2], [level1_code], [level2_code], [gl_code], [trans_date], [descrp], [AG_Descrp], [GL_Descrp], [thisAmt], [thisBalance]) VALUES (78, N'4ba6f5a8-066c-4a13-a559-42357cd3b40f', 0, 7, NULL, 2023, N'1800592 ', N'0021323 ', 1104, N'01 ', N'0910', CAST(N'2023-07-25T00:00:00.000' AS DateTime), N'Item 178', N'Item 278', N'Item 378', CAST(7402.00 AS Decimal(16, 2)), CAST(0.00 AS Decimal(16, 2)))
GO
INSERT [dbo].[Inquiry_GL_BudgetComparison_001_Detail] ([Id], [Batch_Id], [company_code], [MMonth], [MMonth_Name], [YYear], [ref1], [ref2], [level1_code], [level2_code], [gl_code], [trans_date], [descrp], [AG_Descrp], [GL_Descrp], [thisAmt], [thisBalance]) VALUES (79, N'4ba6f5a8-066c-4a13-a559-42357cd3b40f', 0, 7, NULL, 2023, N'1800594 ', N'0021178 ', 1104, N'01 ', N'0910', CAST(N'2023-07-25T00:00:00.000' AS DateTime), N'Item 179', N'Item 279', N'Item 379', CAST(5122.00 AS Decimal(16, 2)), CAST(0.00 AS Decimal(16, 2)))
GO
INSERT [dbo].[Inquiry_GL_BudgetComparison_001_Detail] ([Id], [Batch_Id], [company_code], [MMonth], [MMonth_Name], [YYear], [ref1], [ref2], [level1_code], [level2_code], [gl_code], [trans_date], [descrp], [AG_Descrp], [GL_Descrp], [thisAmt], [thisBalance]) VALUES (80, N'4ba6f5a8-066c-4a13-a559-42357cd3b40f', 0, 7, NULL, 2023, N'0000040673', N'00030282 ', 1104, N'01 ', N'0910', CAST(N'2023-07-28T00:00:00.000' AS DateTime), N'Item 180', N'Item 280', N'Item 380', CAST(100.00 AS Decimal(16, 2)), CAST(0.00 AS Decimal(16, 2)))
GO
INSERT [dbo].[Inquiry_GL_BudgetComparison_001_Detail] ([Id], [Batch_Id], [company_code], [MMonth], [MMonth_Name], [YYear], [ref1], [ref2], [level1_code], [level2_code], [gl_code], [trans_date], [descrp], [AG_Descrp], [GL_Descrp], [thisAmt], [thisBalance]) VALUES (81, N'4ba6f5a8-066c-4a13-a559-42357cd3b40f', 0, 7, NULL, 2023, N'0000040684', N'TT23/5579 ', 1104, N'01 ', N'0910', CAST(N'2023-07-31T00:00:00.000' AS DateTime), N'Item 181', N'Item 281', N'Item 381', CAST(116000.00 AS Decimal(16, 2)), CAST(0.00 AS Decimal(16, 2)))
GO
INSERT [dbo].[Inquiry_GL_BudgetComparison_001_Detail] ([Id], [Batch_Id], [company_code], [MMonth], [MMonth_Name], [YYear], [ref1], [ref2], [level1_code], [level2_code], [gl_code], [trans_date], [descrp], [AG_Descrp], [GL_Descrp], [thisAmt], [thisBalance]) VALUES (82, N'4ba6f5a8-066c-4a13-a559-42357cd3b40f', 0, 7, NULL, 2023, N'400807 ', N'JVHQ070008', 1104, N'01 ', N'0910', CAST(N'2023-07-31T00:00:00.000' AS DateTime), N'Item 182', N'Item 282', N'Item 382', CAST(635752.00 AS Decimal(16, 2)), CAST(0.00 AS Decimal(16, 2)))
GO
INSERT [dbo].[Inquiry_GL_BudgetComparison_001_Detail] ([Id], [Batch_Id], [company_code], [MMonth], [MMonth_Name], [YYear], [ref1], [ref2], [level1_code], [level2_code], [gl_code], [trans_date], [descrp], [AG_Descrp], [GL_Descrp], [thisAmt], [thisBalance]) VALUES (83, N'4ba6f5a8-066c-4a13-a559-42357cd3b40f', 0, 8, NULL, 2023, N'0000040650', N'TT23/5580 ', 1104, N'01 ', N'0910', CAST(N'2023-08-01T00:00:00.000' AS DateTime), N'Item 183', N'Item 283', N'Item 383', CAST(250000.00 AS Decimal(16, 2)), CAST(0.00 AS Decimal(16, 2)))
GO
INSERT [dbo].[Inquiry_GL_BudgetComparison_001_Detail] ([Id], [Batch_Id], [company_code], [MMonth], [MMonth_Name], [YYear], [ref1], [ref2], [level1_code], [level2_code], [gl_code], [trans_date], [descrp], [AG_Descrp], [GL_Descrp], [thisAmt], [thisBalance]) VALUES (84, N'4ba6f5a8-066c-4a13-a559-42357cd3b40f', 0, 8, NULL, 2023, N'0000040695', N'00030304 ', 1104, N'01 ', N'0910', CAST(N'2023-08-01T00:00:00.000' AS DateTime), N'Item 184', N'Item 284', N'Item 384', CAST(605.26 AS Decimal(16, 2)), CAST(0.00 AS Decimal(16, 2)))
GO
INSERT [dbo].[Inquiry_GL_BudgetComparison_001_Detail] ([Id], [Batch_Id], [company_code], [MMonth], [MMonth_Name], [YYear], [ref1], [ref2], [level1_code], [level2_code], [gl_code], [trans_date], [descrp], [AG_Descrp], [GL_Descrp], [thisAmt], [thisBalance]) VALUES (85, N'4ba6f5a8-066c-4a13-a559-42357cd3b40f', 0, 8, NULL, 2023, N'0000040708', N'00030308 ', 1104, N'01 ', N'0910', CAST(N'2023-08-07T00:00:00.000' AS DateTime), N'Item 185', N'Item 285', N'Item 385', CAST(50261.05 AS Decimal(16, 2)), CAST(0.00 AS Decimal(16, 2)))
GO
INSERT [dbo].[Inquiry_GL_BudgetComparison_001_Detail] ([Id], [Batch_Id], [company_code], [MMonth], [MMonth_Name], [YYear], [ref1], [ref2], [level1_code], [level2_code], [gl_code], [trans_date], [descrp], [AG_Descrp], [GL_Descrp], [thisAmt], [thisBalance]) VALUES (86, N'4ba6f5a8-066c-4a13-a559-42357cd3b40f', 0, 8, NULL, 2023, N'0000040699', N'00030312 ', 1104, N'01 ', N'0910', CAST(N'2023-08-07T00:00:00.000' AS DateTime), N'Item 186', N'Item 286', N'Item 386', CAST(656.25 AS Decimal(16, 2)), CAST(0.00 AS Decimal(16, 2)))
GO
INSERT [dbo].[Inquiry_GL_BudgetComparison_001_Detail] ([Id], [Batch_Id], [company_code], [MMonth], [MMonth_Name], [YYear], [ref1], [ref2], [level1_code], [level2_code], [gl_code], [trans_date], [descrp], [AG_Descrp], [GL_Descrp], [thisAmt], [thisBalance]) VALUES (87, N'4ba6f5a8-066c-4a13-a559-42357cd3b40f', 0, 8, NULL, 2023, N'70015559 ', N'BMMB064222', 1104, N'01 ', N'0910', CAST(N'2023-08-10T00:00:00.000' AS DateTime), N'Item 187', N'Item 287', N'Item 387', CAST(-26679.28 AS Decimal(16, 2)), CAST(0.00 AS Decimal(16, 2)))
GO
INSERT [dbo].[Inquiry_GL_BudgetComparison_001_Detail] ([Id], [Batch_Id], [company_code], [MMonth], [MMonth_Name], [YYear], [ref1], [ref2], [level1_code], [level2_code], [gl_code], [trans_date], [descrp], [AG_Descrp], [GL_Descrp], [thisAmt], [thisBalance]) VALUES (88, N'4ba6f5a8-066c-4a13-a559-42357cd3b40f', 0, 8, NULL, 2023, N'0000040750', N'TT23/5599 ', 1104, N'01 ', N'0910', CAST(N'2023-08-11T00:00:00.000' AS DateTime), N'Item 188', N'Item 288', N'Item 388', CAST(246351.62 AS Decimal(16, 2)), CAST(0.00 AS Decimal(16, 2)))
GO
INSERT [dbo].[Inquiry_GL_BudgetComparison_001_Detail] ([Id], [Batch_Id], [company_code], [MMonth], [MMonth_Name], [YYear], [ref1], [ref2], [level1_code], [level2_code], [gl_code], [trans_date], [descrp], [AG_Descrp], [GL_Descrp], [thisAmt], [thisBalance]) VALUES (89, N'4ba6f5a8-066c-4a13-a559-42357cd3b40f', 0, 8, NULL, 2023, N'1800621 ', N'0021375 ', 1104, N'01 ', N'0910', CAST(N'2023-08-18T00:00:00.000' AS DateTime), N'Item 189', N'Item 289', N'Item 389', CAST(685800.00 AS Decimal(16, 2)), CAST(0.00 AS Decimal(16, 2)))
GO
SET IDENTITY_INSERT [dbo].[Inquiry_GL_BudgetComparison_001_Detail] OFF
GO
ALTER TABLE [dbo].[Inquiry_GL_BudgetComparison_001_Detail] ADD CONSTRAINT [DF_Inquiry_GL_BudgetComparison_001_Detail_company_code] DEFAULT ((0)) FOR [company_code]
GO
ALTER TABLE [dbo].[Inquiry_GL_BudgetComparison_001_Detail] ADD CONSTRAINT [DF_Inquiry_GL_BudgetComparison_001_Detail_MMonth] DEFAULT ((0)) FOR [MMonth]
GO
ALTER TABLE [dbo].[Inquiry_GL_BudgetComparison_001_Detail] ADD CONSTRAINT [DF_Inquiry_GL_BudgetComparison_001_Detail_YYear] DEFAULT ((0)) FOR [YYear]
GO
ALTER TABLE [dbo].[Inquiry_GL_BudgetComparison_001_Detail] ADD CONSTRAINT [DF_Inquiry_GL_BudgetComparison_001_Detail_level1_code] DEFAULT ((0)) FOR [level1_code]
GO
ALTER TABLE [dbo].[Inquiry_GL_BudgetComparison_001_Detail] ADD CONSTRAINT [DF_Inquiry_GL_BudgetComparison_001_Detail_thisAmt] DEFAULT ((0.00)) FOR [thisAmt]
GO
ALTER TABLE [dbo].[Inquiry_GL_BudgetComparison_001_Detail] ADD CONSTRAINT [DF_Inquiry_GL_BudgetComparison_001_Detail_thisBalance] DEFAULT ((0.00)) FOR [thisBalance]
GO
This is the physical look
See thisBalance column. I want to get thisBalance value. How to query to get return result as following
Id | descrp | thisAmt | thisBalance
----------------------------------------------------------
1 Item 11 6215.03 6215.03
2 Item 12 149294.34 155509.37
3 Item 13 198778.89 354288.26
4 Item 14 154159.96 508448.22
5 Item 15 15000.00 523448.22
....
....
Id = 1 . thisBalance = 6215.03
Id = 2. thisBalance = 6215.03 + 149294.34
Id = 3. thisBalance = 6215.03 + 149294.34 + 198778.89
Id = 4. thisBalance = 6215.03 + 149294.34 + 198778.89 + 154159.96
Id = 5. thisBalance = 6215.03 + 149294.34 + 198778.89 + 154159.96 + 15000.00
and so on
Please help
For a running total - you can use: thisBalance = SUM(thisAmt) OVER(PARTITION BY Batch_Id ORDER BY Id)
If you want to break out the totals even further, add those to the partition.
Jeffrey Williams
“We are all faced with a series of great opportunities brilliantly disguised as impossible situations.”
― Charles R. Swindoll
How to post questions to get better answers faster
Managing Transaction Logs
September 17, 2023 at 4:32 pm
Hello Sir,
It is masterpiece
September 17, 2023 at 7:05 pm
For a running total - you can use: thisBalance = SUM(thisAmt) OVER(PARTITION BY Batch_Id ORDER BY Id)
If you want to break out the totals even further, add those to the partition.
I recommend that you ALWAYS include the window (in this case ROWS UNBOUNDED PRECEDING
. If you don't include it, you can get unexpected results, although I've only ever seen this with LAST_VALUE()
.
Drew
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply