Hello guys I would like to ask how could I get the total quantity and total price of sales with this format of date. I was have this data in my database.
ID Quantity Price Date
1 10 100 June 27,2016
2 12 120 June 28,2016
3 15 150 June 29,2016
I only getting one data with the first one row of 1 only. I have this query.
$query= $this->db->select('SUM(total_price) as overall_price, SUM(quantity) as total_quantity')->from('sales')
->where('branch',$_SESSION['branch'])->where('date_sold >=',date('F d,Y',strtotime($from)))->where('date_sold <=',date('F d,Y',strtotime($to)))->get();
How could I also get all the records from specific range of date for example from June 27 to June 29 ? I only got 1 record
$query= $this->db->select('*')->from('sales')->where('branch',$_SESSION['branch'])->where('date_sold >=',$from)->where('date_sold <=',$to)->get();
Aucun commentaire:
Enregistrer un commentaire