We have a bit of code that looks like this:
$products = Mage::getModel('catalog/product')->getCollection();
$products->addAttributeToSelect('name');
$products->addAttributeToSelect('sellbydate');
$products->addAttributeToSort('sellbydate','ASC');
This has been working fine, but after enabling flat product data the items are no longer sorted. I have reindexed but there is no change.
Should I be using a different function?
var_dump((string)$products->getSelect());
below your code?