mysql按照月份查询

SELECT
*
FROM
	`bus_invo` 
WHERE
	`entp_code` = 'xx'

SELECT
YEAR(invono_date) AS year, MONTH(invono_date) AS month,sum(total_amounttax) as totalAmount
FROM
	`bus_invo` 
WHERE
	`entp_code` = 'xx' GROUP BY YEAR(invono_date), MONTH(invono_date) order by year,month;
	

 
 
 SELECT
 date_format(invono_date, '%Y-%m')  ym,sum(total_amounttax) as totalAmount
FROM
	`bus_invo` 
WHERE
	`entp_code` = 'xx' GROUP BY ym order by ym;

你可能感兴趣的:(1024程序员节)