嘿,伙计们,您介意检查我是否正确执行此操作吗?我被困在这个问题上:
生成查询以显示平均工作成本高于所有工作的平均工作成本的所有会计师的会计师姓名及其平均工作成本(四舍五入到小数点后两位)。
SELECT
a.name + a.surname,
SUM(jt.cost * (DATEDIFF(mi, time_complete, time_start))) % SUM(job_id) AS average_job_cost
FROM accountant AS a
LEFT OUTER JOIN job AS j ON a.staff_id = j.staff_id
LEFT OUTER JOIN job_type AS jt ON jt.job_type_id = j.job_type_id
WHERE average_job_cost > (SELECT SUM(jt.cost * (DATEDIFF(mi, time_complete, time_start))) % SUM(job_id);