I want to fire select query which is as follows
SET @a = 0;
SELECT @a:=@a+1 as count FROM admin_user;
How I can add SET variable in SQL query in magento.
I want to fire select query which is as follows
SET @a = 0;
SELECT @a:=@a+1 as count FROM admin_user;
How I can add SET variable in SQL query in magento.
First you have run this Query
/* Get the core resource model */
$resource = Mage::getSingleton('core/resource');
/* Retrieve the read connection */
$readConnection = $resource->getConnection('core_read');
$query = 'SELECT @cnt:= 0 ;';
$results = $readConnection->fetchAll($query);
Then Your Query i:e
SELECT @a:=@a+1 as count FROM admin_user;