sql 员工咨询

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sql 员工咨询相关的知识,希望对你有一定的参考价值。

Custom Formulas

 

    Employee Inquiry: Pull “billing rate” from Employee Type setup records and put them with appropriate employees on Employee Inquiry

SELECT etBudgetBillRate

FROM AxVEC

LEFT JOIN AxEmployeeType ON vecEmployeeType = etKey

WHERE vecKey = [Employee Key]

 

    Employee Inquiry: Pull the employee payroll service id from the vec table on employee inquiry

SELECT vecpayrollserviceid from axvec where veckey = [Employee Key]

 

    Employee Inquiry: add the employee regular pay rate (hourly rate) 

SELECT empregularpayrate FROM employee WHERE empkey = [Employee Key]

 

    Add SS Information to Employee Inquiry
    Select empSocialSecurityNumber from Employee where empKey = [Employee Key]

    Employee Effective Regular Pay Rate

SELECT TOP 1 ewRegularPayRate FROM AxEmployeeWage

WHERE ewEmployee = [Employee Key]

ORDER BY ewEmployee, ewStartDate DESC

 

    Employee Effective Pay Start Date

SELECT TOP 1 ewStartDate FROM AxEmployeeWage

WHERE ewEmployee = [Employee Key]

ORDER BY ewEmployee, ewStartDate DESC

 

    Employee Effective Hourly Pay Rate or Salary Pay Amount

SELECT TOP 1 (CASE WHEN ewIsHourly = 1 THEN ewRegularPayRate ELSE ewSalary END) FROM AxEmployeeWage

WHERE ewEmployee = [Employee Key]

ORDER BY ewEmployee, ewStartDate DESC

 

    Check mark for Employee is Hourly

SELECT empishourly FROM employee WHERE empkey = [Employee Key]

 

    Employee Department for any inquiry with employee key

SELECT edescription FROM axentity WHERE ekey = (SELECT vecentity FROM axvec WHERE veckey = [Employee Key]

 

    Phase department on any inquiry with phase key

SELECT edescription FROM axentity WHERE ekey = (SELECT prjentity FROM axproject WHERE prjkey = [Phase Key]

 

    Employee Overhead Group

SELECT togDescription FROM AxVEC JOIN AxTimesheetOverheadGroup ON vecOverheadGroup = togKey WHERE vecKey = [Employee Key] 

 

    Employee Roles

SELECT TOP 1 STUFF((SELECT ', ' + sgDescription

           FROM AxEmployeeRole b

        LEFT OUTER JOIN AxSecurityGroup ON emrRole = sgKey 

           WHERE b.emrEmployee = a.emrEmployee 

          FOR XML PATH('')), 1, 2, '')

FROM AxEmployeeRole a

        LEFT OUTER JOIN AxSecurityGroup ON emrRole = sgKey

WHERE a.emrEmployee = [Employee Key]

GROUP BY a.emrEmployee

 

    Employee Age

SELECT YEAR(GETDATE())-YEAR([Date Born])

 

    Days Until Work Aniversary

datepart(dy, [Date Hired]) - datepart(dy, getdate())

 

    Days Until Birthday

datepart(dy, [Date Born]) - datepart(dy, getdate())

 

 

To Use these Custom Formulas

Copy the desired Formula into the definition of your Inquiry column.

以上是关于sql 员工咨询的主要内容,如果未能解决你的问题,请参考以下文章

咨询师如何处理冲突?

咨询师如何在企业植入新观念?

《金字塔原理》听书笔记

sql 咨询espaciales SQL

sql查询员工编号为2001的员工所下的订单编号、内容及员工姓名信息

怎么用SQL语句创建视图