i want countra Head ,
Create table #Tbl_Customer (C_ID int,C_Name varchar(50))
Create table #tbl_Ledger (ID int,E_Date date,Debit_Head_ID int,Credit_Head_ID int,T_Amount Decimal(10,2),Countra_ID int )
insert into #Tbl_Customer values (1001,'Akhter')
insert into #Tbl_Customer values (1002,'Noman')
insert into #Tbl_Customer values (1003,'Bank')
insert into #Tbl_Customer values (1004,'Akram')
Insert into #tbl_Ledger values (1,'2023-09-01',1001,Null,4000,1003)
Insert into #tbl_Ledger values (1,'2023-09-01',Null,1003,4000,Null)
Insert into #tbl_Ledger values (1,'2023-09-01',1002,Null,1000,1003)
Insert into #tbl_Ledger values (1,'2023-09-01',1004,Null,1000,1003)
if i pass parameter 1003 ,then below output must display
if i pass parameter 1001 ,then below output must display