Last active
August 29, 2015 14:00
-
-
Save jbartek/11050017 to your computer and use it in GitHub Desktop.
SugarQuery - Aliasing
This file contains 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
<?php | |
$query = new SugarQuery(); | |
$query->from(BeanFactory::getBean('Accounts')); | |
$query->join('contacts', array('alias' => 'industryContacts')); | |
$query->join('opportunities', array('relatedJoin' => 'industryContacts', 'alias' => 'contactsOpportunities')); | |
$query->select(array(array('industryAccounts.first_name', 'fname'), array('industryContacts.last_name', 'lname'), 'contactsOpportunities.name')); | |
$query->where()->equals('industryAccounts.industry','Media'); | |
$query->where()->equals('contactsOpportunities.sales_stage', 'closed'); | |
$results = $query->execute(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment