我正在尝试加入你的表,并且有一个 Sum 值,但它没有显示任何错误,但它的值是错误的......但是如果我加入两个表,它可以正常工作。
查询是
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