SSRS显示基本信息

时间:2017-03-09 05:43:51

标签: mysql sql sql-server join reporting-services

如果员工请假,则显示数据

enter image description here

所需输出

但是如果另一名员工没有请假,基本信息应该显示在给定的字段中

enter image description here

我希望填写基本信息字段,无论他是否休假

这是查询

  select LeaveRequest.LeaveRequestID,LeaveRequest.EmployeeID,userName,departmentName,designationName,RequestDate
  ,IsApproved,ApprovedDate,StartDate,EndDate,Name,PartOFDay 
  fromLeaveRequest
  inner join LeaveType
  on LeaveRequest.TypeID=LeaveType.TypeID

  inner join LeaveRequestDetails
  on LeaveRequest.LeaveRequestID=LeaveRequestDetails.LEaveRequestID

  inner join EmployeeInformation
  on LeaveRequest.EmployeeID=EmployeeInformation.employeeID

  inner join Departments
  on Departments.departmentID=EmployeeInformation.departmentID

  inner join Designations
  on Designations.designationID=EmployeeInformation.designationID

  where EmployeeInformation.employeeID=@empID**

2 个答案:

答案 0 :(得分:0)

问题是EmployeeInformation上的INNER JOIN,因为它过滤掉了不在LeaveRequest表中的任何employeeID。 请尝试将其更改为右连接:

right join EmployeeInformation
  on LeaveRequest.EmployeeID=EmployeeInformation.employeeID

答案 1 :(得分:0)

用左外连接替换你的内连接。

感谢, SK