SQL计算时间差并排除周末 CREATE FUNCTION DI_FN_GET_WorkDay (@begin DATETIME , @end DATETIME ) RETURNS int BEGIN IF @end > @begin BEGIN , ) END END ) ), ) AS DATETIME), @begin) ), , ) AS DATETIME)) RETURN @j END sql 计算结束时间 去除周六周末, SQL里dateadd计算日期时跳过周六周日两天计算日期
Code highlighting produced by Actipro CodeHighlighter (freeware)-->去掉法定节假日(周六,周天)和指定节假日 USE [DBName] GO /****** 对象: Table [dbo].[T_SYS_Holiday] 脚本日期: 11/08/2010 16:04:27 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_PADDING ON GO
有clients和lead_sources俩表.mysql数据库. lead_sources表结构类似: clients表中的lead_source_id是外键.现在要统计某时间段内client内每种lead_source所占百分比 ),) as perTotal, a.L_sub_count,b.total_count from ( SELECT LeadSource.name as L_name, count(*) as L_sub_count FROM clients as Client,