Custom column with filter on admin grid in magento

Recently, I have worked on magento admin grid and I want to add custom column with filter on customer grid without adding column in customer table. I have faced lot of issue during this development and after digging continuously 2 hour I found terms addExpressionAttributeToSelect  . This is finally solved my problem.

I did customization on _prepareCollection function and  _prepareColumns function .It worked fine.

In _prepareCollection function, add below expression after getting the $collection

$collection->addExpressionAttributeToSelect('column_column', new Zend_Db_Expr("CUSTOM_MYSQL_EXPRESSSION"), array());

And add following column code in _prepareColumn method.

$this->addColumn('custom_column', array(
'header' => Mage::helper('customer')->__('CUSTOM COLUMN'),
'index' => 'custom_column',

Top selling product collection programmatically in magento

Top selling products :

Here is way to get best selling product collection.

/* Best Seller*/

$visibility = array(

$storeId = Mage::app()->getStore()->getId(); // get default store id

$_productCollection = Mage::getResourceModel('reports/product_collection')
     ->addAttributeToFilter('visibility', $visibility)
     ->setOrder('ordered_qty', 'desc');