SugarCRM 中的糖查询语法错误
Sugar query syntax error in SugarCRM
我正在尝试加入 table 潜在客户。我正在执行此查询
$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");
在这样执行之前。
$queryProspects->execute();
我正在像这样编译我的查询
$queryProspects->compileSql();
此查询在执行后无效。编译后查询结果为
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'
我知道错误是 () WHERE 我需要删除它,但无法更改 sugar 查询以删除这些括号和 where 子句(显示在 sql 生成的查询中)。
请像这样执行您的查询:
$result = $queryProspects->execute();
有关详细信息,请遵循此 link:
Sugar Query
像这样更改并加入语句。
$queryProspects->from(BeanFactory::getBean('Prospects'), array('team_security' => false));
$leads = $queryProspects->join('lead')->joinName();
lead in join 是您潜在客户中的 link(名称字段)> vardefs.php,如下所示。
'lead' => array(
'name' => 'lead',
'type' => 'link',
'relationship' => 'lead_prospect',
'module' => 'Leads',
'source' => 'non-db',
'vname' => 'LBL_LEAD',
),
我正在尝试加入 table 潜在客户。我正在执行此查询
$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");
在这样执行之前。
$queryProspects->execute();
我正在像这样编译我的查询
$queryProspects->compileSql();
此查询在执行后无效。编译后查询结果为
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'
我知道错误是 () WHERE 我需要删除它,但无法更改 sugar 查询以删除这些括号和 where 子句(显示在 sql 生成的查询中)。
请像这样执行您的查询:
$result = $queryProspects->execute();
有关详细信息,请遵循此 link: Sugar Query
像这样更改并加入语句。
$queryProspects->from(BeanFactory::getBean('Prospects'), array('team_security' => false));
$leads = $queryProspects->join('lead')->joinName();
lead in join 是您潜在客户中的 link(名称字段)> vardefs.php,如下所示。
'lead' => array(
'name' => 'lead',
'type' => 'link',
'relationship' => 'lead_prospect',
'module' => 'Leads',
'source' => 'non-db',
'vname' => 'LBL_LEAD',
),