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计算日期时跳过周六周日两天计算日期
有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,