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

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**

最佳答案

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

right join EmployeeInformation
  on LeaveRequest.EmployeeID=EmployeeInformation.employeeID

关于mysql - SSRS显示基本信息,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/42687640/

10-14 12:32