SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.`value)` = 1) AND (`IF(brand_status`.`value IS NULL, main_table`.`status, brand' at line 11, query was: SELECT COUNT(*) FROM `brand` AS `main_table`
 LEFT JOIN (SELECT `main_table`.* FROM `brand_store_value` AS `main_table` WHERE (`store_id` = '2') AND (`attribute_code` = 'name')) AS `brand_value_name` ON main_table.brand_id = brand_value_name.brand_id
 LEFT JOIN (SELECT `main_table`.* FROM `brand_store_value` AS `main_table` WHERE (`store_id` = '2') AND (`attribute_code` = 'is_featured')) AS `brand_value_is_featured` ON main_table.brand_id = brand_value_is_featured.brand_id
 LEFT JOIN (SELECT `main_table`.* FROM `brand_store_value` AS `main_table` WHERE (`store_id` = '2') AND (`attribute_code` = 'page_title')) AS `brand_value_page_title` ON main_table.brand_id = brand_value_page_title.brand_id
 LEFT JOIN (SELECT `main_table`.* FROM `brand_store_value` AS `main_table` WHERE (`store_id` = '2') AND (`attribute_code` = 'meta_keywords')) AS `brand_value_meta_keywords` ON main_table.brand_id = brand_value_meta_keywords.brand_id
 LEFT JOIN (SELECT `main_table`.* FROM `brand_store_value` AS `main_table` WHERE (`store_id` = '2') AND (`attribute_code` = 'meta_description')) AS `brand_value_meta_description` ON main_table.brand_id = brand_value_meta_description.brand_id
 LEFT JOIN (SELECT `main_table`.* FROM `brand_store_value` AS `main_table` WHERE (`store_id` = '2') AND (`attribute_code` = 'short_description')) AS `brand_value_short_description` ON main_table.brand_id = brand_value_short_description.brand_id
 LEFT JOIN (SELECT `main_table`.* FROM `brand_store_value` AS `main_table` WHERE (`store_id` = '2') AND (`attribute_code` = 'description')) AS `brand_value_description` ON main_table.brand_id = brand_value_description.brand_id
 LEFT JOIN (SELECT `main_table`.* FROM `brand_store_value` AS `main_table` WHERE (`store_id` = '2') AND (`attribute_code` = 'status')) AS `brand_value_status` ON main_table.brand_id = brand_value_status.brand_id
 LEFT JOIN `brand_store_value` AS `brand_is_featured` ON main_table.brand_id = brand_is_featured.brand_id AND brand_is_featured.store_id = 2 AND brand_is_featured.attribute_code = 'is_featured'
 LEFT JOIN `brand_store_value` AS `brand_status` ON main_table.brand_id = brand_status.brand_id AND brand_status.store_id = 2 AND brand_status.attribute_code = 'status' WHERE (`IF(brand_is_featured`.`value IS NULL, main_table`.`is_featured, brand_is_featured`.`value)` = 1) AND (`IF(brand_status`.`value IS NULL, main_table`.`status, brand_status`.`value)` = 1)

#0 /var/app/current/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
#1 /var/app/current/app/code/core/Zend/Db/Statement.php(291): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
#2 /var/app/current/lib/Zend/Db/Adapter/Abstract.php(480): Zend_Db_Statement->execute(Array)
#3 /var/app/current/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('SELECT COUNT(*)...', Array)
#4 /var/app/current/lib/Varien/Db/Adapter/Pdo/Mysql.php(504): Zend_Db_Adapter_Pdo_Abstract->query('SELECT COUNT(*)...', Array)
#5 /var/app/current/lib/Zend/Db/Adapter/Abstract.php(828): Varien_Db_Adapter_Pdo_Mysql->query(Object(Varien_Db_Select), Array)
#6 /var/app/current/lib/Varien/Data/Collection/Db.php(225): Zend_Db_Adapter_Abstract->fetchOne(Object(Varien_Db_Select), Array)
#7 /var/app/current/app/design/frontend/wiser/default/template/shopbybrand/templates/temp02/shopbybrand.phtml(34): Varien_Data_Collection_Db->getSize()
#8 /var/app/current/app/design/frontend/wiser/default/template/shopbybrand/shopbybrand.phtml(2): include('/var/app/curren...')
#9 /var/app/current/app/code/core/Mage/Core/Block/Template.php(241): include('/var/app/curren...')
#10 /var/app/current/app/code/core/Mage/Core/Block/Template.php(272): Mage_Core_Block_Template->fetchView('frontend/wiser/...')
#11 /var/app/current/app/code/core/Mage/Core/Block/Template.php(286): Mage_Core_Block_Template->renderView()
#12 /var/app/current/app/code/core/Mage/Core/Block/Abstract.php(923): Mage_Core_Block_Template->_toHtml()
#13 /var/app/current/app/code/core/Mage/Core/Block/Text/List.php(43): Mage_Core_Block_Abstract->toHtml()
#14 /var/app/current/app/code/core/Mage/Core/Block/Abstract.php(923): Mage_Core_Block_Text_List->_toHtml()
#15 /var/app/current/app/code/core/Mage/Core/Block/Abstract.php(641): Mage_Core_Block_Abstract->toHtml()
#16 /var/app/current/app/code/core/Mage/Core/Block/Abstract.php(585): Mage_Core_Block_Abstract->_getChildHtml('content', true)
#17 /var/app/current/app/design/frontend/wiser/default/template/page/1column.phtml(60): Mage_Core_Block_Abstract->getChildHtml('content')
#18 /var/app/current/app/code/core/Mage/Core/Block/Template.php(241): include('/var/app/curren...')
#19 /var/app/current/app/code/core/Mage/Core/Block/Template.php(272): Mage_Core_Block_Template->fetchView('frontend/wiser/...')
#20 /var/app/current/app/code/core/Mage/Core/Block/Template.php(286): Mage_Core_Block_Template->renderView()
#21 /var/app/current/app/code/core/Mage/Core/Block/Abstract.php(923): Mage_Core_Block_Template->_toHtml()
#22 /var/app/current/app/code/core/Mage/Core/Model/Layout.php(555): Mage_Core_Block_Abstract->toHtml()
#23 /var/app/current/app/code/core/Mage/Core/Controller/Varien/Action.php(390): Mage_Core_Model_Layout->getOutput()
#24 /var/app/current/app/code/local/Magestore/Shopbybrand/controllers/IndexController.php(57): Mage_Core_Controller_Varien_Action->renderLayout()
#25 /var/app/current/app/code/core/Mage/Core/Controller/Varien/Action.php(418): Magestore_Shopbybrand_IndexController->indexAction()
#26 /var/app/current/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(254): Mage_Core_Controller_Varien_Action->dispatch('index')
#27 /var/app/current/app/code/core/Mage/Core/Controller/Varien/Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#28 /var/app/current/app/code/core/Mage/Core/Model/App.php(365): Mage_Core_Controller_Varien_Front->dispatch()
#29 /var/app/current/app/Mage.php(684): Mage_Core_Model_App->run(Array)
#30 /var/app/current/index.php(85): Mage::run('', 'store')
#31 {main}