Você quer dizer assim ? SELECT SUM(cost) as total FROM sales where (passport = $myPassport AND paid <> 1)