Fees_Transaction Table Data Show Here
DGV
Regno Class Jan Feb Mar
A100 I 50 650 400
A200 I 100 250 0
FeeMaster Table Data Show Here
DGV
Regno Class Jan Feb Mar
A100 I 650 750 1000
A200 I 650 750 1000
I Need OUTPUT LIKE THIS
Regno Class Jan Feb Mar
A100 I 600 100 600
A200 I 550 500 1000
Please Tell me How Can I Do this
I am using CODE
Dim strSQL11
strSQL11 = "SELECT STUFF((SELECT DISTINCT ',['+ FeesType +']' FROM FeeMaster WHERE Class='" & cboClass.Text & "' For XMl Path('')), 1, 1, '')"
Dim DaAp11 As New SqlDataAdapter(strSQL11, con)
Dim Dset11 As New DataTable
DaAp11.Fill(Dset11)
Dim strSQL10
strSQL10 = "SELECT * FROM (SELECT stdAdmission.Regno, stdAdmission.Class, Fees_Transaction.FeeType," & _
" Fees_Transaction.Amount_Paid FROM Fees_Transaction INNER JOIN stdAdmission ON Fees_Transaction.Regno=stdAdmission.Regno) FeeMaster" & _
" PIVOT (Sum(Amount_Paid) for FeeType in (" + Dset11.Rows(0).Item("Column1") + "))as PVT where Class='" & cboClass.Text & "'"
Dim DaAp10 As New SqlDataAdapter(strSQL10, con)
Dim Dset10 As New DataTable
DaAp10.Fill(Dset10)
DGV1.DataSource = Dset10
Dim strSQL12
strSQL12 = "SELECT * FROM (SELECT stdAdmission.Regno, stdAdmission.Class, FeesMaster.FeeType," & _
" FeesMaster.FeeAmount FROM FeesMaster INNER JOIN stdAdmission ON FeesMaster.Regno=stdAdmission.Regno) FeeMaster" & _
" PIVOT (Sum(FeeAmount) for FeeType in (" + Dset11.Rows(0).Item("Column1") + "))as PVT where Class='" & cboClass.Text & "'"
Dim DaAp12 As New SqlDataAdapter(strSQL12, con)
Dim Dset12 As New DataTable
DaAp12.Fill(Dset12)
DataGridView2.DataSource = Dset12