SELECT 2 AS query_pos, npossel.* FROM ( SELECT @rownum := @rownum + 1 AS position, ABS(FLOOR(RAND() * (CEIL(@rownum + 3) - CEIL(@rownum - 3) + 1)) + CEIL(@rownum - 3)) AS `new_position`, ctrsel.* FROM ( SELECT IF((clicks / impressions) * 100 IS NULL, 0, (clicks / impressions) * 100) AS ctr_order, categories.*, 0 AS parent_id, 'fulltext' AS related_type FROM categories LEFT JOIN stats_ctr ON source_id = '1206' AND id = target_id AND target_type = 'category' AND source_type = 'category' WHERE MATCH(title) AGAINST ('Decorar Casas (casa house casas) decor* femininos, movéis, casa, decoração e natal' IN BOOLEAN MODE) AND url NOT IN ('decorar_casas', 'papa', 'orkut', 'papa_jogos', 'jogos_para_orkut') AND status='online' AND quantity>=5 ORDER BY hits DESC) AS ctrsel CROSS JOIN (SELECT @rownum := 0) AS pos ORDER BY ctr_order DESC LIMIT 13) AS npossel ORDER BY new_position ASC, position ASC LIMIT 10