SQL inner join 3 tables (error)

  • Thread starter Thread starter Amuro__
  • Start date Start date
A

Amuro__

Guest
Here is my code

rs.Open("SELECT a.TransID, a.TProdName, a.TQty, a.TTotal, a.TDate, " _
& "b.ProdName, b.ProdOrigPrice, b.ProdPriceperKG, " _
& "c.ProdName, c.Prodperkg " _
& "FROM (tblTransactionlog a " _
& "INNER JOIN tblNewProd b ON a.TProdName = b.ProdName) " _
& "INNER JOIN tblStock c ON a.TProdName = c.ProdName " _
& "WHERE a.TDate LIKE '" & Format$(mpath, "0#") & "/%" & myear & "'", db)


with this code the recordcount doubles (for example, if recordcount is 10 it becomes 20)

But when I remove the 2nd inner join it returns correctly.

rs.Open("SELECT a.TransID, a.TProdName, a.TQty, a.TTotal, a.TDate, " _
& "b.ProdName, b.ProdOrigPrice, b.ProdPriceperKG " _
& "FROM tblTransactionlog a " _
& "INNER JOIN tblNewProd b ON a.TProdName = b.ProdName " _
& "WHERE a.TDate LIKE '" & Format$(mpath, "0#") & "/%" & myear & "'", db)

recordcount doesnt double.

How can I use 3 or more inner joins in vb.net using ms access that wont double the recordcount?

Continue reading...
 
Back
Top