не слишком заморочено?
$q = microapp::sql()->select(
array(
'forum_thread.*',
'users.login',
'users.ontime',
'users.name'
)
)
->from('forum_thread')
->left('users')
->on('last_post_author','id')
->where(
array(
array('forum_thread.parent_id', '=', 4),
array('forum_thread.thread_fixed', '=', 1)
),
array(
array('forum_thread.about', '=', 1)
)
)
->order('forum_thread.thread_fixed', 'DESC')
->order('forum_thread.last_time', 'DESC')
->limit(800, 20)->exec();
/*
SELECT `forum_thread`.*, `users`.`login`, `users`.`ontime`, `users`.`name`
FROM `forum_thread` LEFT JOIN `users`
ON `forum_thread`.`last_post_author` = `users`.`id`
WHERE (forum_thread.parent_id = 4 AND forum_thread.thread_fixed = 1) OR (forum_thread.about = 1)
ORDER BY `forum_thread`.`thread_fixed` DESC, `forum_thread`.`last_time` DESC
LIMIT 800, 20
*/Все больше склоняюсь к мысле, что писать нативно и быстрее. и приятнее