Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/316.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 查询查找员工当前天数_Java_Sql Server_Oracle11g - Fatal编程技术网

Java 查询查找员工当前天数

Java 查询查找员工当前天数,java,sql-server,oracle11g,Java,Sql Server,Oracle11g,我在我的应用程序中使用了两台服务器/数据库-1SQLServer 2Oracle 在oracle中,我有一个假日表,其列如下: **HOLIDAY_ID** - NUMBER(10,0) **HOLIDAY_NAME** - VARCHAR2(150 BYTE) **HOLIDAY_DATE** - TIMESTAMP(6) **DAY_OF_WEEK** - VARCHAR2(20 BYTE) **HOLIDAY_TYPE_ID** - NUMBER **DELETE_FLAG** - VAR

我在我的应用程序中使用了两台服务器/数据库-1SQLServer 2Oracle 在oracle中,我有一个假日表,其列如下:

**HOLIDAY_ID** - NUMBER(10,0)
**HOLIDAY_NAME** - VARCHAR2(150 BYTE)
**HOLIDAY_DATE** - TIMESTAMP(6)
**DAY_OF_WEEK** - VARCHAR2(20 BYTE)
**HOLIDAY_TYPE_ID** - NUMBER
**DELETE_FLAG** - VARCHAR2(5 BYTE)
使用此表,我计算了一个月内的工作/营业日、假日、周末的数量,如下所示:

PreparedStatement psmnt = conn_pasta.prepareStatement("select payroll_id as payrollId,emp_name_formatted as empName,"
                                + " nvl((select designation_name from designation where designation_id=employee.designation_id),'-') as empDesig,"
                                + " (select count(*) "
                                + " from ( select rownum rnum "
                                + " from all_objects "
                                + " where rownum <= to_date(to_char(last_day(to_date('01-'||'"+currentMonth1+"'||'"+currentYear+"','DD-MM-YYYY')),'DD')||'"+currentMonth1+"'||'"+currentYear+"','DD-MM-YYYY') - to_date('01-'||'"+currentMonth1+"'||'"+currentYear+"','DD-MM-YYYY')+1 ) "
                                + " where to_char( to_date('01-'||'"+currentMonth1+"'||'"+currentYear+"','DD-MM-YYYY')+rnum-1, 'DY' ) "
                                + " not in ( 'SAT', 'SUN' )) - (select count(*) from admin_holiday where to_char(holiday_date,'DD-MON-YYYY') like '%-' || '"+currentMonth1+"' || '-' || '"+currentYear+"' || '%' and holiday_type_id=1) workingdays,"                               
                                + " (select count(*) "
                                + " from ( select rownum rnum "
                                + " from all_objects "
                                + " where rownum <= to_date(to_char(last_day(to_date('01-'||'"+currentMonth1+"'||'"+currentYear+"','DD-MM-YYYY')),'DD')||'"+currentMonth1+"'||'"+currentYear+"','DD-MM-YYYY') - to_date('01-'||'"+currentMonth1+"'||'"+currentYear+"','DD-MM-YYYY')+1 ) "
                                + " where to_char( to_date('01-'||'"+currentMonth1+"'||'"+currentYear+"','DD-MM-YYYY')+rnum-1, 'DY' ) "
                                + " in ( 'SAT', 'SUN' )) weekends,"                             
                                + " (select count(*) from admin_holiday where to_char(holiday_date,'DD-MON-YYYY') like '%-' || '"+currentMonth1+"' || '-' || '"+currentYear+"' || '%' and holiday_type_id=1) holidays"                                                      
                                + " from employee where DEL_FLAG=1 order by payrollId");
其中employee是存储各种员工详细信息的表,currentMonth1和currentYear是从外部传递的值

在SQLServer中 我有一个考勤表,列为: 日期、状态、输入、输出、工作时间

现在,我必须编写一个查询,使用第二个表和从第一个查询中检索到的数据来查找员工的当前天数 我第一次尝试的是countworkhour,它提供了适当的输出,但问题是它还包括员工在周末和假日时一天的工作时间。但我只想要一个月的工作日的工作时间,不包括周末或节假日的工作时间(如果有的话)


我如何做到这一点?

现在,您是指员工在工作的哪几天,还是多少天?所有员工的考勤数据是否通用?仅从列名我无法理解此表中的内容,请给出几个示例行并进行解释。一个月内的每一天是否有一行?否,不是daysday名称,而是天数是必需的。否,不是daysday名称,而是天数是必需的。数据库中给出的表名类似于year.dbo.month,即2017.dbo.JAN,因此每个月实际上都有一个单独的表,根据员工id存储所有员工的数据。日期列包含该特定月份的所有日期值。从2017年1月1日到2017年1月31日,状态显示有/无,2017年emp的IN shows inTime和OUT shows outTime的员工和工作时间实际上是outTime和inTimeSo之间的差异。dbo.JAN,dbo是员工ID吗?如果这个考勤表是正确的,你就不能忽略其他数据库中的数据吗?我越来越糊涂了,我想你应该解释得更好。从头开始。你可以在问题中,而不是在评论中。