SELECT offer_id , MAX(`date`) AS maxdate FROM orders WHERE percent > 0 GROUP BY offer_id ORDER BY maxdate DESC ;o)