AnsweredAssumed Answered

SugarQuery - Aggregates not working..

Question asked by Mehul Bhandari on Oct 2, 2017
Latest reply on Oct 2, 2017 by Mehul Bhandari

Hi Folks

 

Running a query in MySQL. it's working but the same I'm trying with SugarQuery not getting any result.

Query..

 

MySQL Query - 

SELECT enjay_tally_group_c, count(0) AS record_count 

FROM tl_tally_ledger_cstm 
GROUP BY enjay_tally_group_c

 

And same trying with SugarQuery.

 

$sugarQuery = new SugarQuery();
$SugarQuery->select(array('enjay_tally_group_c'))->setCountQuery();
$sugarQuery->from(BeanFactory::newBean("tl_Tally_Ledger"));
$SugarQuery->groupByRaw('tl_tally_ledger.enjay_tally_group_c');
$sugarQuery->select(array('enjay_tally_group_c'));
$sugarQuery_result = $sugarQuery->execute();

 

Whats wrong in above sugarquery.

Francesca Shiekh  André Lopes Ajay Kumar Angel Magana

 

Thanks

Mehul

Outcomes