情况一:
SELECT SUM(mark) AS totalMark, userID, credit
FROM users, marks
WHERE marks.receiverID = users.userID
AND userID = '2'
它会回来
totalMark userID credit
---------------------------
0 2 0.0
而且非常好,没问题。但这里是情况2:
SELECT SUM(mark) AS totalMark, userID, credit
FROM users, marks
WHERE marks.receiverID = users.userID
AND userID = '-1'
结果:
totalMark userID credit
---------------------------
NULL NULL NULL
但我想要的是什么都不返回(没有找到记录)。任何人都可以帮助我吗?