I have created below collection query in my custom external magento page--
<?php
$mageFilename = 'app/Mage.php';
require_once $mageFilename;
Mage::setIsDeveloperMode(true);
ini_set("display_errors", 1);
ini_set('max_execution_time', 3000);
umask(0);
Mage::init('default');
Mage::app();
$start_date='2016-03-01';
$end_date='2016-04-01';
$orderCollection=Mage::getModel('sales/order')->getCollection();
try{
$orderCollection->getSelect()->join(array('order_history'=> sales_flat_order_status_history), "main_table.entity_id=order_history.parent_id WHERE (order_history.entity_name = 'invoice' OR order_history.entity_name = 'shipment') AND order_history.status = 'complete' AND order_history.created_at >= '".$start_date."' and order_history.created_at < '".$end_date."' ", array('order_history.parent_id'));
}
catch(Exception $e)
{
echo $e->getMessage();
}
this query gives me following error--
Notice: Use of undefined constant sales_flat_order_status_history - assumed 'sales_flat_order_status_history'
I don't know, what wrong there ? Can anybody found out the problem there? thanks in advance.