select a.bangou,a.name, tokuten = case when a.tokuten> b.tokuten then a.tokuten else b.tokuten end from course1 a join course2 b on a.bangou = b.bangou