Shoeb
May 3, 2017, 1:22pm
1
This is my code in TablesController…
$curt_date = date(‘Y-m-d’);
$bills = TableRegistry::get(‘bills’);
$bill_product = $bills->find(‘all’,
array(‘conditions’ => array(‘bills.added_date’ => $curt_date)),
‘fields’ => array([
‘product_id’,
‘sum(quantity) as quantity_TOTAL’,
‘sum(productprice) as Total’]),
‘group’ => ‘product_id’);
rrd
May 3, 2017, 6:42pm
2
$bill_product = $bills->find(
'all',
array(
'conditions' => array(
'bills.added_date' => $curt_date
),
'fields' => array(
'product_id',
'sum(quantity) as quantity_TOTAL',
'sum(productprice) as Total'
),
'group' => 'product_id'
)
);
Why do not you use an IDE with syntax highlighting?
Shoeb
May 4, 2017, 6:01am
3
Thanks rrd,
I have try to your provide code in my code but unfortunately getting error as attachments…
Try this
// Results in SELECT id AS pk, title AS aliased_title, body …
$query = $articles->find();
$query->select([‘pk’ => ‘id’, ‘aliased_title’ => ‘title’, ‘body’]);
Try this
$bill_product = $bills->find(
'all',
array(
'conditions' => array(
'bills.added_date' => $curt_date
),
'fields' => array([
'product_id',
'sum(quantity) as quantity_TOTAL',
'sum(productprice) as Total'
]),
'group' => 'product_id'
)
);