結果 : how to use aggregate function in case statement in sql