1.
{ $select = $this->_getReadAdapter()->select()->from(array('main_table' => $this->getMainStoreTable($category->getStoreId())), array('main_table.entity_id', 'main_table.name'))->where('main_table.entity_id IN (?)', array_reverse(explode(',', $category->getPathInStore()))); if ($isActive) { $select->where('main_table.is_active = ?', '1'); } $select->order('main_table.path ASC'); }
And then 2:
{ $select->joinLeft(array('url_rewrite' => $this->_resource->getTableName('core/url_rewrite')), 'url_rewrite.category_id=main_table.entity_id AND url_rewrite.is_system=1 AND ' .$this->_connection->quoteInto('url_rewrite.store_id = ? AND ', (int)$storeId) .$this->_connection->prepareSqlCondition('url_rewrite.id_path', array('like' => 'category/%')), array('request_path' => 'url_rewrite.request_path'));
Now in this join, I want to add use index for join(index). So is it possible to form such queries in Magento some how?