我想将paycheck_detail查询的结果与时间表查询的结果结合在一起,并加入employeeId。每个员工在每个工资期都有一条薪水记录,需要加入第一个匹配的时间表记录才能填写pdf表格。
查询1
SELECT employeeId, workday, hours FROM timesheet WHERE weekEndingDate = '2019-01-19'
employeeId workday hours
------------ ------------ -------
25 2019-01-18 2.68
25 2019-01-18 4.05
25 2019-01-18 2.75
29 2019-01-18 3.25
29 2019-01-18 4
29 2019-01-18 2.75
查询2
SELECT * FROM paycheck_detail WHERE weekEndingDate = '2019-01-19'
employeeId weekendingdate fica federal local state checkNumber
------------ ---------------- ------- --------- ------- ------- -------------
29 2019-01-19 26.06 19.00 3.41 10.46 13325
25 2019-01-19 47.00 19.20 5.60 11.20 13326
所需结果
employeeId workday hours fica federal local state checkNumber
------------ ------------ ------- ------- --------- ------- ------- ------------- --
25 2019-01-18 2.68 47.00 19.20 5.60 11.20 13326
25 2019-01-18 4.05
25 2019-01-18 2.75
29 2019-01-18 3.25 26.06 19.00 3.41 10.46 13325
29 2019-01-18 4
29 2019-01-18 2.75