Join multiple tables by multiple grouping
We have a passing control system and every pass action is stored Event table in MSSQL Server . We want to join multiple tables with the Event table according to their relations as shown on the image below. However, I am not sure if the grouping approach that I used is correct or not because the query takes a lot of time. Could you please clarify me oh how to join these tables by multiple grouping? Here is the JOIN clause I used: SELECT t.CardNo, t.EventTime, t1.EmployeeName, t1.Status, t2.EventCH, t3.DoorName, t4.JobName, t5.DeptName FROM Event t LEFT JOIN Employee AS t1 ON t.EmployeeID = t1