13,042,421 members (112,660 online)
Rate this:
See more:
Hi all

How to join Two Talble(Table1 is Fees_Transaction AND Table 2 is FeesMaster) With Condition

Here I use Code But It's Not Work Proper

`Dim strSQL5 As String = "SELECT Fees_Transaction.Regno, Fees_Transaction.ST_Name, SUM(Fees_Transaction.Amount_Paid) as FTAmountPaid,SUM(FeesMaster.FeeAmount) As TotalFeeAmount FROM  Fees_Transaction INNER JOIN FeesMaster  ON Fees_Transaction.Regno=FeesMaster.Regno and  Fees_Transaction.FeeType=FeesMaster.FeeType WHERE Fees_Transaction.class='" & cboClass.Text & "'  GROUP BY Fees_Transaction.Regno, Fees_Transaction.ST_Name"`

Above Code ERROR is..

FeesMAster SUM Calculate Problem..

Pleaes HElp This COde..
Posted 19-Jan-13 6:30am
Updated 19-Jan-13 7:21am
v2
Member 12931435 13-Apr-17 11:46am

How to Join more than 1 database table in sql express(visualstudio 2010 )?

Rate this:

Solution 1

You should have shared what was not working properly for you.

Try:
```SELECT
Fees_Transaction.Regno, Fees_Transaction.ST_Name, SUM(Fees_Transaction.Amount_Paid) as FTAmountPaid,SUM(FeesMaster.FeeAmount) As TotalFeeAmount
FROM
Fees_Transaction
INNER JOIN
FeesMaster ON Fees_Transaction.Regno=FeesMaster.Regno
WHERE
Fees_Transaction.class='" & cboClass.Text & "'  AND Fees_Transaction.FeeType=FeesMaster.FeeType
GROUP BY
Fees_Transaction.Regno, Fees_Transaction.ST_Name```

Refer: MSDN: Using Inner Joins[^]
Navas Khanj 19-Jan-13 15:35pm

My FeesMaster.FeeAmount Calculate Two Time.. For Example My FeeAmount Data(750 + 650)=1400 but that one not Show Correct Value on DGV It Show 2800.. But Amount_Paid is Show Correct Value on DGV.
Sandeep Mewara 19-Jan-13 15:43pm

If you are sure that there is no duplicate record, try to put and see DISTINCT in the query in start and see:
SELECT
DISTINCT Fees_Transaction.Regno,...
Navas Khanj 19-Jan-13 16:07pm

I try to DIdtinct also but value calculate two time

Top Experts
Last 24hrsThis month
 Karthik Bangalore 130 Satya Prakash Swain 130 OriginalGriff 105 Richard MacCutchan 100 ppolymorphe 95
 OriginalGriff 4,215 RickZeeland 1,834 F-ES Sitecore 1,483 ppolymorphe 1,454 Dave Kreskowiak 1,309