Method I : SELECT count('id') as cnt,order_status,order_date FROM `product_order` group by MONTH(order_date) Method II : SELECT count('id') as cnt,order_status,order_date FROM `product_order` group by DATE_FORMAT(order_date, '%m') Method III: SELECT SQL_NO_CACHE YEAR(record_date), MONTH(record_date), COUNT(*) FROM stats GROUP BY YEAR(record_date)*100 + MONTH(record_date) SELECT YEAR(date_column), MONTH(date_column), COUNT(*) FROM date_table GROUP BY DATE_FORMAT(date_column, '%Y%m')
Html, JAVA,DOTNET,Javascript, PHP, and JQuery Scripts and its issues with solutions
Showing posts with label group by. Show all posts
Showing posts with label group by. Show all posts
Monday, 30 June 2014
MySQL Query GROUP BY day / month / year
Subscribe to:
Posts (Atom)