Skip links

Query nesneleri ile GroupBy ve Sum Almak


Notice: Trying to access array offset on value of type bool in /var/www/vhosts/dmrbt.com/httpdocs/wp-content/themes/boo/rella/extensions/aq_resizer/aq_resizer.php on line 117

Notice: Trying to access array offset on value of type bool in /var/www/vhosts/dmrbt.com/httpdocs/wp-content/themes/boo/rella/extensions/aq_resizer/aq_resizer.php on line 118

Notice: Trying to access array offset on value of type bool in /var/www/vhosts/dmrbt.com/httpdocs/wp-content/themes/boo/rella/extensions/aq_resizer/aq_resizer.php on line 117

Notice: Trying to access array offset on value of type bool in /var/www/vhosts/dmrbt.com/httpdocs/wp-content/themes/boo/rella/extensions/aq_resizer/aq_resizer.php on line 118
Query nesneleri ile GroupBy ve Sum Almak

Select Sum(AmountMst) from LedgerTrans
Group By LedgerTrans.Voucher, LedgerTrans.TransDate
koduna denk olan query alttaki gibi yazılabilir:

Query q;
QueryRun qr;
QueryBuildDataSource qbdsLedgerTrans;
LedgerTrans ledgerTrans;
;
q = new Query();
qbdsLedgerTrans = q.addDataSource(tableNum(LedgerTrans));
qbdsLedgerTrans.addSortField(FieldNum(LedgerTrans, Voucher));
qbdsLedgerTrans.addSortField(FieldNum(LedgerTrans, TransDate));
qbdsLedgerTrans.orderMode(OrderMode::GroupBy);
qbdsLedgerTrans.addSelectionField(FieldNum(LedgerTrans, AmountMST), SelectionField::Sum);
qr = new QueryRun(q);
while(qr.next())
{
ledgerTrans = qr.get(TableNum(LedgerTrans));
this.send(ledgerTrans);
}

Join the Discussion