I have one to many relationship in two tables. I want to fetch records based on equals values (of specific field) in both the tables. Right now I am doing it like this
$queryProspects = new SugarQuery();
$queryProspects->from(BeanFactory::getBean('Prospects'), array('team_security' => false));
$leads = $queryProspects->join('lead')->joinName();
$queryProspects->select(array("first_name"));
$queryProspects->where()->equals('first_name', 'leads.first_name');
$resultProspects = $queryProspects->execute();
You can see in the equals method I am trying to match first_name of prospects table with the first_name of leads table.
The problem I am facing here is that second argument of equals method is considered as a complete value like 'leads.first_name' rather than the value of first_name field in the leads table. I want to match first_name of prospects table with first_name of leads table. How can I go with it?