D
Don
The way I understand it, a LEFT JOIN uses all the records in the "left"
table, but only those record in "right" table that link to the left table.
So if I have something like:
.....
FROM tblPosition AS P LEFT JOIN tblPerson AS R ON P.PositionNumber =
R.PositionNumber
....
the result of the query should have the same number of records as in
tblPosition. (For the sake of this example, say there are 10 positions and
8 persons.)
Now, my problem comes when I add my WHERE clause:
WHERE P.PositionLocation IN ( strPositionFundingStatus )
AND R.PersonStatus In ( strProgramStatusCSV )
' strPositionLocation' has a list of sites
'strPersonStatus is either "Full", "Part", or "Full, Part"
If I limit the WHERE clause to
WHERE P.PositionLocation IN ( strPositionFundingStatus )
the query returns 10 records. However, if I include the the field from the
"right" table, the query 'ignore' the LEFT join part and returns only 8
records.
(Basically, the query reports who is on what position, and some positions
are open. We want to show the open positions.)
Any ideas will be greatly appreciated!
Thanks!
Don
table, but only those record in "right" table that link to the left table.
So if I have something like:
.....
FROM tblPosition AS P LEFT JOIN tblPerson AS R ON P.PositionNumber =
R.PositionNumber
....
the result of the query should have the same number of records as in
tblPosition. (For the sake of this example, say there are 10 positions and
8 persons.)
Now, my problem comes when I add my WHERE clause:
WHERE P.PositionLocation IN ( strPositionFundingStatus )
AND R.PersonStatus In ( strProgramStatusCSV )
' strPositionLocation' has a list of sites
'strPersonStatus is either "Full", "Part", or "Full, Part"
If I limit the WHERE clause to
WHERE P.PositionLocation IN ( strPositionFundingStatus )
the query returns 10 records. However, if I include the the field from the
"right" table, the query 'ignore' the LEFT join part and returns only 8
records.
(Basically, the query reports who is on what position, and some positions
are open. We want to show the open positions.)
Any ideas will be greatly appreciated!
Thanks!
Don