Situation 1:
SELECT SUM(mark) AS totalMark, userID, credit
FROM users, marks
WHERE marks.receiverID = users.userID
AND userID = '2'
It will return
totalMark userID credit
---------------------------
0 2 0.0
And it is very good, no problem. But here is the situation 2:
SELECT SUM(mark) AS totalMark, userID, credit
FROM users, marks
WHERE marks.receiverID = users.userID
AND userID = '-1'
Result:
totalMark userID credit
---------------------------
NULL NULL NULL
But what I want is return nothing (no record found). Anyone could help me?