Loading…

Explain how to write custom SQL Query in Magento?

We can write custom queries in Magento. Please follow the below given examples.

Example

                                        

$resource = Mage::getSingleton(\'core/resource\');
$readConnection = $resource->getConnection(\'core_read\');
$var_query = \'SELECT * FROM products_table\';
$var_results = $readConnection->fetchAll($var_query);
var_dump($var_results);

Suggest An Answer

No suggestions avaliable!

Latest post from Magento Interview Questions

Ask Question