Skip to content
Advertisement

Not getting data when trying to create multiple inner join on 2 columns from the same table

I have a table and data like below:

Employee:

LeaveRequest:

LeaveUpdateLogs:

Now here I want to calculate statistics as below for a particular department:

Total number of requests sent and received for DepartmentId 100.

But I am confused here for getting data for “Sent” and “Received” like below:

But this doesn’t return any data although I have “25” records between this 2 dates. When I comment out this 3 lines:

Then query is working fine but I want to get the data for particular department.

Can someone please help me fix this logic?

Advertisement

Answer

Since I think you are only asking how to join on multiple values here are a couple ways of you could tackle this.

Or

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement