title: Query to join three tables With Sum
body: <p>I am trying to join thee tables and there's one Sum value but its not showing any error but its a wrong value... but if I join with two table it working correctly.</p>
  
  <p>the query is </p>
  
  <pre><code>SELECT  tblEmployeeInfo.EmpCode, 
          SUM(tblLeave.lvDay) AS Total, 
          tblAtData.card_no
  
  FROM    tblEmployeeInfo 
  INNER JOIN tblLeave ON tblEmployeeInfo.EmpCode = tblLeave.lvEmpId 
  INNER JOIN tblAtData ON tblEmployeeInfo.EmpCardID = tblAtData.card_no
  
  WHERE  (tblLeave.lvMonth = @month)
  
  GROUP BY tblEmployeeInfo.EmpCode, tblAtData.card_no
  </code></pre>