ItHurtsWhenIThink
Technical User
SELECT
U.FName, U.LName, U.EmployeeID,U.UserID, Count(D.DrillTime)
FROM tr_Drills AS D INNER JOIN Tr_Individuals AS I ON D.DrillID = I.DrillID
RIGHT JOIN Users AS U ON I.MemberID = U.UserID
WHERE D.DrillTime>=3 AND D.DeptID=1
Group By U.LName, U.FName,U.EmployeeID,U.UserID
Order By U.LName
(tables listed at bottom of page)
This statement should get me all the users in the Users table.... I think (ouchhh)
I want to get every user listed and then include how many drills they attended where the drillTime is three hours or greater (not aggragate).
The result provides only those where there is a match in the Tr_Individuals table.
Any thoughts???
Tables:
Users
UserID (int)
DeptID (int)
LName
FName
EmployeeID (char)
tr_Drills
DrillID (int)
DeptID (int)
DrillDate (smalldate)
DrillTime (numeric)
tr_Individuals
CrewID
DrillID
MemberID
UnitID
U.FName, U.LName, U.EmployeeID,U.UserID, Count(D.DrillTime)
FROM tr_Drills AS D INNER JOIN Tr_Individuals AS I ON D.DrillID = I.DrillID
RIGHT JOIN Users AS U ON I.MemberID = U.UserID
WHERE D.DrillTime>=3 AND D.DeptID=1
Group By U.LName, U.FName,U.EmployeeID,U.UserID
Order By U.LName
(tables listed at bottom of page)
This statement should get me all the users in the Users table.... I think (ouchhh)
I want to get every user listed and then include how many drills they attended where the drillTime is three hours or greater (not aggragate).
The result provides only those where there is a match in the Tr_Individuals table.
Any thoughts???
Tables:
Users
UserID (int)
DeptID (int)
LName
FName
EmployeeID (char)
tr_Drills
DrillID (int)
DeptID (int)
DrillDate (smalldate)
DrillTime (numeric)
tr_Individuals
CrewID
DrillID
MemberID
UnitID