How to convert raw php LEFT JOIN query in to magento query? What is Magentos syntax for?

Here is my query:

SELECT fieldsmanager_orders.value,sales_flat_order_address.entity_id
FROM fieldsmanager_orders
LEFT JOIN sales_flat_order_address ON fieldsmanager_orders.entity_id = sales_flat_order_address.entity_id;

1 Answer 1


You can call your parent collection model like

$collection = Mage::getModel('fieldsmanager/orders')->getCollection();

Note: Make sure your namespace/entity is correct.

Then from the main collection you can join the sales_flat_order_address table.


Parameters description

Here in first parameter you pass the table you want to join with.You can use an array of the format array('alias' => 'namespace/entity')

In second parameter you add your condition to join with.

and in third one you pass the columns you want from join. "*" resembles for all columns. If you want specific column you can pass in that array.

  • i have two table fieldsmanager_orders, and sales_flat_order_address Commented Jun 23, 2017 at 12:58
  • Yes so this will work as above. You can load your main table collection ( fieldsmanager_orders) then you can join it with sales_flat_order_address table as shown above.
    – Priyank
    Commented Jun 23, 2017 at 13:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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