Select only specific fields in Magento
I recognise this is an old post but I thought I'd post an alternative solution.
I had a similar problem myself, I eventually searched through the source until I reached Zend_Db_Select
After consulting the Zend Documentation (Example 8).
$select = $db->select()
->from(array('p' => 'products'),
array('product_id', 'product_name'));
Magento provide addFieldToSelect() fumctionality. Use below code to get specific field.
$Collection = Mage::getModel('showdown/votes')->getCollection();
$Collection->addFieldToSelect('id');
A Zend trick can be used here.
$_updates->getSelect()
->reset(Zend_Db_Select::COLUMNS)
->columns('MAX(created) as max_created')
->group(array('status_id'));
NOTE:
For EAV collection you must re-add the entity_id
or you will have an error when the collection is loaded.
$collection = Mage::getModel('catalog/product')
->getCollection();
$collection->getSelect()
->reset(Zend_Db_Select::COLUMNS)
->columns(array('entity_id'));
$collection
->addAttributeToSelect(array('image','small_image','thumbnail'))
->addFieldToFilter('entity_id', array('in' => $simple_ids));