2017-03-09 170 views
0

如果僱員採取離開數據示SSRS顯示基本信息

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 [email protected]** 
+0

作爲很好的做法,我總是包含將始終存在,在這種情況下,您EmployeeInformation表中的數據表開始。然後做LEFT加入可能有或沒有相關數據的表格。我發現可視化要簡單得多。 –

回答

0

的問題是內部上EmployeeInformation JOIN,因爲它是過濾掉這不是在任何employeeIDs LeaveRequest表。 嘗試將其更改爲右連接:

right join EmployeeInformation 
    on LeaveRequest.EmployeeID=EmployeeInformation.employeeID 
+0

這工作Thankyou – AKB

0

用左外部連接替換您的內部連接。

感謝, SK