我正在尝试从表中获取特定月份和年份的一些记录,但我只有完整的日期字段。
在上图中,我想从日期中选择数据,但仅限于 (2015-09)
例如:
SELECT * FROM attendance WHERE date = (year-month)
最佳答案
您可以使用year
和month
函数:
SELECT * FROM attendance WHERE year(`date`) = '2015' and month(`date`) = '9'
关于php - 从日期字段中选择特定数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38763900/