来源:蜘蛛抓取(WebSpider)
时间:2016-05-11 06:03
标签:
河南省省长李克
一个难写的分组求和SQL,求高人赐教_百度知道
一个难写的分组求和SQL,求高人赐教
人力资源表中有一字段入职日期,有一字段离职日期,如何GROUP某一年的12个月的实有人数?
提问者采纳
例;!这个是按月算,如果按年算;,离职日期大于当月月初或者是离职日期字段为null:员工在当月的实有人数是所有入职日期小于当月月末HR软件中一般算法是:select count(1) from employee where comedate&=':2012年1月实际员工数量; and (leavedate&=',把当月更换为当年就是,说明未离职
其他类似问题
'。比如 2月1号离职,'.000':00;':00;京名'end--select * from @tbAselect M:00:00;,',sum(case when N;,
EDate datetime)insert into @tbselect '' union allselect ','declare @ERQ DateTime set @ERQ=' union allselect ' union allselect '':00; union allselect ',1),'谭浩'肖九功' declare @tbA table( id int identity(1:00;:00;,设置好分割点.RQ执行结果:00.RQ>:00; set @temp=@temp+1:00,'李克'; union allselect '.EDate )group by M;';declare @temp int set @temp=0declare @end int set @end=datediff(m?如下有个例子:00,';方小勇',',
SD;':00;; 00;':00.000 9 00,@temp,',@ERQ)while @temp&;;'.000 10 00,'.RQ; union allselect '','':00.000 9 00.000 9 00;张凯'何文文', RQ datetime )--这就是设置分割点的地方了declare @SRQ DateTime set @SRQ=',',''姚乐'',' union allselect ':00,'':00,'',':00,':RQ
人数 00,',','.000 10 00;@endbegin insert into @tbA(RQ) values (DATEADD(m;.SDate and M;N;,'.000 9 00;'':自己改动一下;郭晓'任志强';:00:00.000 10 00;缴之化''.000 9---回头别忘记+红包啊;; union allselect '.000 8 00:00;;; union allselect ':00;':00:00:00;'',@SRQ)).Emp is null then 0 else 1 end) as 人数 from @tbA M left join @tb N on(M;周文学','李之边'.RQ&.000 10 00;',@SRQ:00,你记录入2月实有人数么.000 10 00,' 00,' union allselect '.000 0 00;';':00,'.000'?如果是2月18号离职 怎么算;' union allselect ':00;':00;。declare @tb table(
Emp nvarchar(10);N;;',' union allselect '这个再于你怎么设置分切点
为您推荐:
其他1条回答
mm' end || rownum ny FROM DUAL CONNECT BY LEVEL &) and to_char(离职日期,':建函数一般效率;= 01 AND LEVEL <:select ny,(SELECT case when length(rownum)=1 then '0',sum(case when ny between to_char(入职日期,') then 1 end)mm'高率效率
分组的相关知识
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁