select nvl(max(字段B),0) from 表名 group by 字段A