select b.*,
a.recid,
a.keyno
from product b,
(select pcode,
keyno,
max(reccid) recid
from productstr
group by pcode, keyno) a
where b.pcode = a.pcode(+)
and b.keyno = a.keyno(+);
-------------
说明:
1.含max(reccid)等的函数,reccid不用放到group by
2.group by 中的count()不用放到select
即:select max(b.a) from b group by b.c having count(b.d)>1