Magento Certified Developer GuideCategory: 4. DatabaseDescribe the role of Zend_Db_Select in Magento
Manish Prakash Staff asked 5 years ago

This class is used by magento for all its select queries on flat tables. This class has functions for all the select operations which we perform on a table. Below the important functions are described.

        $db = Mage::getModel('core/resource')->getConnection('core_read');
        $select = $db->select();
        $select->from(array('c' => 'core_resource'))->where('id = ?', 1);
        $select->orWhere('code = ?', 'adminnotification_setup');
        $select->order(array(Zend_Db_Select::SQL_DESC => 'version'));
        $select->limit(10, 20);
        $select->columns(array('code', 'version'));
        $select->joinLeft(array('e' => 'core_config_data'), ' = c.version');
//        $select->query();  //execute the query
        echo $select;

Different type of joins are explain here