mysql计算工作日_MySQL
程序员文章站
2022-05-24 11:17:54
...
bitsCN.com
bitsCN.com
mysql计算工作日
Sql代码 DELIMITER $$ drop procedure if exists `pGetWorkDays`$$ create procedure pGetWorkDays(s datetime,e datetime) begin select floor(days/7)*5+days%7 -case when 6 between wd and wd+days%7-1 then 1 else 0 end -case when 7 between wd and wd+days%7-1 then 1 else 0 end from (select datediff(e,s)+1 as days,weekday(s)+1 as wd) as a; end$$ DELIMITER ; call pGetWorkDays('2005-01-01','2005-12-31');
bitsCN.com
推荐阅读
-
PHP和MySQL的删除空白函数介绍
-
mysql-show profile 中 query end 状态含义
-
jdbc操作mysql数据库实例
-
『MySQL』索引类型 normal, unique, full text
-
MySQL 1594错误解决方法_MySQL
-
MySQL 启动报错:File ./mysql-bin.index not found (Errcode: 13)_MySQL
-
Python+Django+SAE系列课程13-MySQL记录的添删改
-
MySQL 获取多个字段最大值最小值
-
mysql-登陆MySQL提示SQL执行错误#3167,怎么解决?
-
教你轻松的掌握 连接字符集和校对_MySQL