結果 : join table based on case statement sql