I want to get the where
condition from a collection.I'm using it in my sales order grid.
$collection = $this->getCollection();
echo $this->getCollection()->getSelect();
When i apply getselect
to the collection i could see the corresponding query with where condition:
SELECT `main_table`.*, `myorder`.`customer_email` FROM `sales_flat_order_grid` AS `main_table`
LEFT JOIN `sales_flat_order` AS `myorder` ON myorder.entity_id = main_table.entity_id
WHERE (`main_table`.`status` = 'received')
ORDER BY main_table.created_at DESC LIMIT 20
But I want to know is there any other way to get where
condition directly from the collection itself.
I want to apply that where
to another query of mine.