Risolto:
codice:
SELECT DISTINCT *, MAX(time) AS ultimamodifica
FROM mos_sb_messages GROUP BY thread
ORDER BY ultimamodifica DESC
LIMIT $top
grazie