- 限定條件:2021年8月,寫法有很多種,比如用year/month函數的
year(date)=2021 and month(date)=8
,比如用date_format函數的date_format(date, "%Y-%m")="202108"
- 每天:按天分組
group by date
- 題目數量:count(question_id)
selectday(date) as day,count(question_id) as question_cnt
from question_practice_detail
where month(date)=8 and year(date)=2021
group by date
1.然后可以用 substring(date,起點下標,截取個數)也可以獲取? ?其中部分數據
2.然后匹配月份可以(比如想要八月份的內容的數據) :date like '2021-08%'