当前位置:首页 » 编程语言 » 写sql查询职工张三的出勤率
扩展阅读
webinf下怎么引入js 2023-08-31 21:54:13
堡垒机怎么打开web 2023-08-31 21:54:11

写sql查询职工张三的出勤率

发布时间: 2022-09-21 06:08:38

A. sql server中查询每个班级的出勤率(出勤人数/班级人数),有学员信息表和出勤表(到校和没到校的都有记录)怎么

每个子查询,查询出来的结果都有可能是多个,因为你分组了。他会把每个班级的人数进行统计,结果就是多个
这样就可以了:
select rount(t1.实际出勤人数/t2.班级人数,2) from
(select count(goschool) 实际出勤人数 ,cclass from tx_scheck where goschool='到校' group by cclass) t1
inner join
(select count(*) 班级人数 , sclass from tx_xsxxb a where a.ifgoschool='在校' group by sclass) t2 on t1.cclass = t2.sclass

B. SQL : 表A (id 出勤时间)查询出某个ID在某个时间内的出勤记录 怎么写语句

哥们,你给的A表没有有关员工标识的列,就是指出哪条是赵四的,哪条是张三的,别人怎么帮你
假设表A是这样的 :表A ID 出勤时间(datatime(8)) 用户名称(或用户ID)

那么SQL是:
SELECT COUNT(id) ,用户名称(或用户ID)
FROM A
GROUP BY 用户名称(或用户ID)
把表数据按用户分组,然后取出每个组的出出勤次数COUNT(id),和对应的用户

C. sql中怎么统计工作日出勤情况

1.你还得有张日期表,规定一年365天哪天是周末,哪天是节假日,也就是日期类型(其实就是日历)
2.出勤表中日期和日期表中的日期连接根据日期类型就知道哪天是节假日哪天是正常上班时间了
3.旷工天数应该就是出勤表中上班签到时间或者下班签到时间为空的话就算旷工了
4.休息日加班天数就是出勤表和日期表连接,日期类型是休息日,并且上班签到和下班签到时间都不为空了
总之,有张日期表什么都能检索出来了

D. 求SQL查询语句。。有出勤表。1个人有多次出勤。。求出勤次数最多的人的名字

select c.user_name
from (select count(*) as cout, t.user_name
from tbl_cq t
group by t.user_name) c
where c.cout = (select max(cout)
from (select count(*) as cout, t.user_name
from tbl_cq t
group by t.user_name));
或者可以用视图或临时表来简化该查询语句

E. sql 考勤统计查询

select name,dept,count(*) 工作天数,sum(xbsj-sbsj) 工作累计时间,count(case when kqqk=1 then 1 end) 迟到天数,count(case when kqqk=2 then 1 end) 早退天数
from table1 join table2 on table1.uid=table2.uid
group by name,dept

F. 员工考勤统计怎么写sql语句,查询出勤率,迟到次数,早退次数,旷工次数

你的给子段,给点模拟数据

G. 请教一条关于SQL查询考勤数据的语句

记录吐吐舌头疼了。

H. sql查询连续出勤记录

楼主的笔误很多啊,看看是不是这个效果。
declare @tab table (dt datetime , ur varchar(12))
insert into @tab
select '2007-01-02','2014' union all
select '2007-01-04','2014' union all
select '2007-01-08','2014' union all
select '2007-01-09','2014' union all
select '2007-01-10','2014' union all
select '2007-01-11','2014' union all
select '2007-01-13','2014' union all
select '2007-01-14','2014' union all
select '2007-01-15','2014' union all
select '2007-01-17','2014' union all
select '2007-01-18','2014' union all
select '2007-01-20','2014' union all
select '2007-01-21','2014' union all
select '2007-01-22','2014' union all
select '2007-01-23','2014' union all
select '2007-01-25','2014' union all
select '2007-01-29','2014'

select *
from @tab a
where exists(select * from @tab where datediff(dd,dt,a.dt) in (1,-1))
order by 1

I. 求助高手啊,出勤率sql语句怎么写

你表结构是什么样的啊,现在只能给你个思路了,比如这个月全勤是26天,超过或等于26天的就100%,没超过的,就出勤天数/26就OK了

J. sql 统计出勤状况 select

select a.name,
(select count(1) from b
where b.usid=a.usid and b.状态='迟到' group by b.usid) as ‘迟到’,
(select count(1) from b
where b.usid=a.usid and b.状态='早退' group by b.usid) as ‘早退’
from a