AnsweredAssumed Answered

Sugar query syntax error in SugarCRM

Question asked by umair jameel on May 25, 2016
Latest reply on May 27, 2016 by Tevfik Tümer

I am trying to join table prospects with leads. I am executing this query

 

$queryProspects = new SugarQuery();
$queryProspects->from(BeanFactory::getBean('Prospects'));
$leads = $queryProspects->joinTable('leads');
$queryProspects->select("prospects.id","prospects.lead_id");
$queryProspects->where()->equals("lead_id","117c3d5d-07d9-0ae7-5610-573ac87c9a35");

 

This query is not executing. I have compiled this query to see its sql form and I got this.

SELECT prospects.id id, prospects.lead_id lead_id FROM prospects JOIN leads ON () WHERE prospects.deleted = 0 AND prospects.lead_id = '117c3d5d-07d9-0ae7-5610-573ac87c9a35'

I know the error is () WHERE which I need to remove, but unable to do changes in sugar query in order to remove these brackets and where clause (which are showing in sql generated query).

Note: I need to change where condition later, this is just for example.

Outcomes