我想显示当月内的结果
例
选择* FROM table_name WHERE date =“ THIS MONTH” ...
我该如何替换“本月”以获取当月的结果
最佳答案
使用日期功能提取月份并与您要匹配的月份的数字进行比较:-
Select * FROM table_name WHERE MONTH(date)= [0 - 11];
您可能还需要匹配正确的年份:-
Select * FROM table_name WHERE MONTH(date) = month(current_timestamp) and year(date) = year(current_timestamp);