I have a custom table and I want to join it with the customer table in order to get a custom customer attribute value. This is my collection:
$collection = Mage::getResourceModel('adyen_subscription/subscription_collection')
->addEmailToSelect()
->addNameToSelect();
$collection->getSelect()->joinLeft(
['cue' => 'customer_entity'],
'cue.entity_id = main_table.customer_id');
$collection->getSelect()->join( array('ce2' => 'customer_entity_varchar'), 'ce2.entity_id=cue.entity_id', array('custom_customer_attribute_code' => 'value'));
Right now I m getting all of the values from all of the customer attributes. The idea should be
select * from table A left join table customers where A.customer_id = customers.entity_id where custom_customer_attribute_code = 'my_custom_code'
How can I do that ?