Created
March 12, 2017 15:41
-
-
Save mrkhoa99/904e21aed68cbff0b10a607aecc94c1c to your computer and use it in GitHub Desktop.
Magento 2 strick
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1) Using an expression as a join: new Zend_Db_Expr | |
$query = 'SELECT author_id, SUM(amount) AS author_debit_amount FROM author_debits GROUP BY author_debits.author_id'; | |
$collection->getSelect()->joinLeft( | |
new Zend_Db_Expr('('.$query.')'), | |
'main_table.author_id = t.author_id', | |
array('author_debit_amount') | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment