想问问mysql如何查询当季新品销售额的查询的语句,,因为季节会涉及到跨年,,所以很难根据销售日去确定它是不是当季新品的销售。。
漂亮男人2017-04-25 09:04:47
select DATE_FORMAT(updated_at,'%m') from instances where DATE_FORMAT(updated_at,'%m') between 10 and 12
However, this method is not recommended, because using functions in query conditions will make the query very slow. Generally, in this case, an additional field [quarter] will be created in the table, and this field will be maintained at the same time when the sales date is updated. I have previously done a chart project that collected statistics by hour, morning, afternoon, evening, day, week, month and quarter. Considering the large amount of data, I used another field to maintain it