Ý bạn là như thế này? SELECT SUM(cost) as total FROM sales where (passport = $myPassport AND paid <> 1)