SELECT DISTINCT(i.id), i.*
  FROM gallery_images AS i
    INNER JOIN gallery_image_category AS ic ON i.id = ic.image_id
   WHERE category_id = 110
   ORDER BY date_available DESC, file ASC, id ASC
   LIMIT 0,3;
[mysql error 1] Can't create/write to file '/tmp/#sql_1220_0.MYI' (Errcode: 28)