[英]Deleting weekend data in MySQL table
I have some tables in MySQL db.我在 MySQL 数据库中有一些表。 My table has date as one of its columns and has data for last one year.
我的表将日期作为其列之一,并包含过去一年的数据。 I want to delete the data of weekends since that is of no use to me.
我想删除周末的数据,因为那对我没有用。 Is it possible to delete the weekend data from these db tables with an SQL query ?
是否可以使用 SQL 查询从这些数据库表中删除周末数据?
There is inbuild function in mysql to find days of week. mysql 中有 inbuild 函数来查找星期几。
delete from table where DAYOFWEEK(date) in (1,7)
where 1 = Sunday, 7 = Saturday其中 1 = 星期日,7 = 星期六
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.