更新时间:2023-01-28 15:01:26
使用 DATE() 或 CURDATE() MySQL 函数:-
返回所有当前日期的值:-
select * from table where DATE(emailsend)=CURDATE()
返回所有不是当前日期的值:-
select * from table where DATE(emailsend) !=CURDATE()
或者使用 MySQL WEEKDAY() 返回一周中某一天的索引给定日期(0 表示周一,1 表示周二,......6 表示周日)
select * from table where WEEKDAY(emailsend) !=0//返回所有非星期一的值
I have a SQL database that has a column "A" that has timestamps in it.
How do I return all values that have a timestamp that doesnt fall under the current day. So say for example its Monday, i want to return all values that are not this Monday.
Use DATE() or CURDATE() MySQL function:-
Return all values that are current date :-
select * from table where DATE(emailsend)=CURDATE()
Return all values that are not current date :-
select * from table where DATE(emailsend) !=CURDATE()
Or use MySQL WEEKDAY() returns the index of the day in a week for a given date (0 for Monday, 1 for Tuesday and ......6 for Sunday)
select * from table where WEEKDAY(emailsend) !=0
//Return all values where day not is monday