SELECT container.i_autocode as id FROM container
INNER JOIN image_infofr ON (container.i_autocode=image_infofr.i_foreigncode)
INNER JOIN container_topic2 ON (container.i_autocode=container_topic2.i_containercode)
INNER JOIN topic2 ON (container_topic2.i_foreigncode=topic2.i_autocode)
INNER JOIN image_file ON (image_file.i_foreigncode=container.i_autocode)
LEFT JOIN containerrating ON (containerrating.i_foreigncode=container.i_autocode)
LEFT JOIN _statmedia ON (_statmedia.i_containercode=container.i_autocode) WHERE topic2.i_leftidx>=585 AND topic2.i_rightidx<=586 AND container.i_mode&16777215
AND container.b_isonline=1 AND container.i_typemsk&3 AND container.i_infomsk&15 GROUP BY container.i_autocode ORDER BY image_infofr.d_created DESC, container.dt_setonline DESC
LIMIT 227, 1