Tu veux dire comme ça ? SELECT SUM(cost) as total FROM sales where (passport = $myPassport AND paid <> 1)