select * from (
select a.id,a.cntid,a.subject,a.previewfile,a.producetime,b.name,
row_number() over (patition by cntid order by A.producetime desc) rank1
from A,B where a.status=1 and b.status=1 and a.id=b.id
)
where rank1<=5