试试这个:
select max(hh1),max(rq1),max(rq2),max(rq3),max(rq4) from (select distinct a.hh as hh1,
  decode(b.jcdm,'010',b.qsrq) rq1,decode(b.jcdm,'020',b.qsrq) rq2,  decode(b.jcdm,'030',b.qsrq) rq3,decode(b.jcdm,'040',b.qsrq) rq4
 FROM yhda a,jcgl b where a.hh=b.hh);