Hi
CREATE TABLE [dbo].[tblloanmaster](
[ShareNo] [int] NULL,
[LoanNo] [decimal](20, 0) NULL,
[Loanamt] [decimal](18, 2) NULL,
[Balanceamount] [decimal](18, 2) NULL
) ON [PRIMARY]
CREATE TABLE [dbo].[tblsharemaster](
[ShareNo] [int] NULL,
[NameE] [varchar](50) NULL,
[Balance] [decimal](10, 2) NULL
) ON [PRIMARY]
Select * from tblsharemaster
Select * from tblloanmaster
Insert into tblsharemaster VALUES(100,'AA1',1000)
Insert into tblsharemaster VALUES(101,'AA2',2000)
Insert into tblsharemaster VALUES(102,'AA3',3000)
Insert into tblloanmaster VALUES(100,1,0,0)
Insert into tblloanmaster VALUES(100,2,2000,45000)
Insert into tblloanmaster VALUES(102,3,3000,8500)
Insert into tblloanmaster VALUES(103,4,3000,8500)
Insert into tblloanmaster VALUES(102,5,0,0)
Insert into tblloanmaster VALUES(101,6,0,0)
Select * from tblsharemaster a left join tblloanmaster b on a.shareNo=b.ShareNo
-- so for output this
Shareno namee Balance ShareNo Loanno loanamt balanceamt
100 AA1 1000.00 100 1 0.00 0.00
100 AA1 1000.00 100 2 2000.00 45000.00
101 AA2 2000.00 0 101 0 0
102 AA3 3000.00 102 3 3000.00 8500.00
102 AA3 3000.00 102 5 0.00 0.00
-- But I need Output this
--ShareNo NameE LoanNo Loanamt
100 AA1 2 2000.00
101 AA2 6 0
102 AA3 3 3000.00
Mark as Answer if its helpful to you
Kumaraspcode2009@gmail.com