SELECT a.CODE,a.CREATIONTIME,a.PK_MATERIAL from bd_material b,(SELECT CODE,max(CREATIONTIME) as time from bd_material GROUP BY CODE ORDER BY COUNT(*)DESE)a where b.CODE=a.CODE and b.CREATIONTIME=a.time
SELECT a.CODE,a.CREATIONTIME,a.PK_MATERIAL from bd_material b,(SELECT CODE,max(CREATIONTIME) as time from bd_material GROUP BY CODE ORDER BY COUNT(*)desc)a where b.CODE=a.CODE and b.CREATIONTIME=a.time