結果 : nested case statement in postgresql