- Joined
- 31 Dec 2003
- Posts
- 5,172
- Location
- Barrow-In-Furness
I've set up a correlated SQL query but i'm not entirely sure i've got it right.
The purpose of it is to get all the unapproved hours for a TimeCode where the CodeOwner matches @username.
It gets the unapproved hours for every code rather than the ones for the UserName.
The purpose of it is to get all the unapproved hours for a TimeCode where the CodeOwner matches @username.
It gets the unapproved hours for every code rather than the ones for the UserName.
Code:
SELECT ID, TimeCode, Date, Hours, Username, Comments, Approved,
(SELECT CodeOwner FROM lward.tblCodes WHERE tblCodes.CodeID = tblHours.TimeCode AND CodeOwner = @UserName) as CodeOwner
FROM lward.tblHours
WHERE Approved is NULL