在我开始研究如何做到这一点之前,我主要是问这个问题,看看我是否正朝着正确的方向前进,因为我是新手。
在构建和加载表之后,我被提供了一个查询,该查询需要是下表的内容。在SQL Server上,我应该使用Select Into为此创建一个临时表,并用查询填充该表吗?或者有更简单的方法吗?
表:
http://puu.sh/gRF1N/86a1afad30.png
查询(我不确定括号中的内容"出席原因"是否,但我认为它与自定义表相关联?):
SELECT
dbo_HR_EMPLOYEE_ATTENDANCE.EMPLOYEE_ID ,
dbo_HR_EMPLOYEE_ATTENDANCE.HR_ATTENDANCE_REASON_CODE ,
dbo_HR_ATTENDANCE_REASON.DESCRIPTION ,
dbo_HR_EMPLOYEE_ATTENDANCE.EMP_ATTENDANCE_DATE ,
dbo_HR_EMPLOYEE_ATTENDANCE.UNITS
FROM
( dbo_HR_EMPLOYEE_ATTENDANCE
LEFT JOIN dbo_HR_ATTENDANCE_REASON ON ( dbo_HR_EMPLOYEE_ATTENDANCE.HR_ATTENDANCE_REASON_CODE = dbo_HR_ATTENDANCE_REASON.HR_ATTENDANCE_REASON_CODE )
AND ( dbo_HR_EMPLOYEE_ATTENDANCE.INST_ID = dbo_HR_ATTENDANCE_REASON.INST_ID )
)
LEFT JOIN [ATTENDANCE REASON] ON dbo_HR_EMPLOYEE_ATTENDANCE.HR_ATTENDANCE_REASON_CODE = [ATTENDANCE REASON].Reason_Code
WHERE
( ( ( dbo_HR_EMPLOYEE_ATTENDANCE.EMP_ATTENDANCE_DATE ) >= '4/1/2014'
AND ( dbo_HR_EMPLOYEE_ATTENDANCE.EMP_ATTENDANCE_DATE ) < '7/1/2014'
)
AND ( ( dbo_HR_EMPLOYEE_ATTENDANCE.FY ) = 2014 )
AND ( ( [ATTENDANCE REASON].Reason_Direction ) = "u" )
);
感谢。