Home > Database > Mysql Tutorial > mysql计算工作日_MySQL

mysql计算工作日_MySQL

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-01 13:30:51
Original
1823 people have browsed it

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');  
Copy after login

 


bitsCN.com
Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template