how to write a query to count date wise product uploaded?

I tried this but I am unable to implement it in codeigniter

 select date, count(distinct productcount) as productcount from product group by date 
Asked on February 5, 2020 in Mysql.

Hey,solved the query it is

$this->zcart_db->select('created_at,COUNT(created_at) as counted_products,created_at as count_date');

$this->zcart_db->from(TBL_PRODUCTS);

$this->zcart_db->group_by('created_at');
on February 5, 2020.

solution is

$this->zcart_db->select('COUNT(created_at) as counted_products,DATE(created_at) as date, COUNT(sale_count) as count');

$this->zcart_db->from(TBL_PRODUCTS);

$this->zcart_db->order_by('date','desc');

$this->zcart_db->group_by('date');
on February 7, 2020.
Add Comment
0 Answer(s)

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.