我正在使用Oracle APEX,我在查询如何制作它时有点困惑。我创建了两个具有以下属性的表
Employees( "EMP_ID",
"EMP_NAME",
"EMP_DESIGNATION" ,
"EMP_ADDRESS" ,
"EMP_GENDER",
"EMP_CONTACT",
"EMP_EMAIL" ,
"EMP_JOINING_DATE",
CONSTRAINT "PK_EMP_ID" PRIMARY KEY ("EMP_ID") ENABLE
);`
和
Attendance
( ATT_ID,
EMP_ID,
ATT_STATUS,
ATT_IN DATE,
ATT_OUT DATE,
ATT_COMMENTS,
CONSTRAINT "PK_ATT_ID" PRIMARY KEY ("ATT_ID") ENABLE
CONSTRAINT "FK_EMP_ID" FOREIGN KEY ("EMP_ID") REFERENCES "EMPLOYEES" ("EMP_ID"));
我已从Att_Out
中减去Att_In
以获得我得到的MINUTES时间,然后multiply
将.69
与select emp_id,sum(((att_out-att_in)*1440)*.69) as "minutes*sal/m"
from attendance group by emp_id;
相加,这是每分钟员工的工资在查询图中显示。
select EMP_ID,EMP_NAME
我想从Employees
表INNER JOIN
获取上面提到的其余查询。我使用group by
,但后来{{1}}函数给了我错误。
答案 0 :(得分:1)
试试这个
SELECT e.emplid, e.emp_name,
sum(((a.att_out-a.att_in)*1440)*.69) as "minutes*sal/m"
FROM Employees e
inner join attendance a on e.emplid = a.emplid
group by e.emplid, e.emp_name
答案 1 :(得分:0)
尝试以下查询
select emp_id,sum(((att_out-att_in)*1440)*.69) as "minutes*sal/m" from attendance a,employees e
where e.emp_id=a.emp_id
group by emp_id;
答案 2 :(得分:0)
SELECT e.emp_id, e.emp_name, sum(((a.att_out-a.att_in)*1440)*.69) as "minutes*sal/m"
FROM Employees e
inner join attendance a on e.emp_id = a.emp_id
group by e.emp_id, e.emp_name;
答案 3 :(得分:0)
这可能对您有所帮助:
SELECT e.emplid, e.emp_name,
sum(((a.att_out-a.att_in)*1440)*.69) as employees_salary_per_minute
FROM Employees e
inner join attendance a on e.emplid = a.emplid
group by e.emplid, e.emp_name