1

How should I convert following sql statement into magento statement.

select value from customer_address_entity_varchar where attribute_id = 143 and entity_id = 567;
1

you can do that with below query

    $connectionresource = Mage::getSingleton('core/resource');
    $readconnection = $connectionresource->getConnection('core_read');
    $allrecord = $readconnection->select()->from(array('customer'=>'customer_address_entity_varchar'),array('customer.value'))->where('customer.attribute_id=?', 143)->where('customer.entity_id=?', 567);
    $alldata =$readconnection->fetchOne($allrecord);
    echo $alldata;
2

Try this:

    echo "<pre>";
$result = array();
$read = Mage::getSingleton('core/resource')->getConnection('core_read'); 
$result = $read->fetchAll('select value from customer_address_entity_varchar where attribute_id = 143 and entity_id = 567');
print_r($result);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.