Returning Rows That Don't have Inner Join

Bopo

New member
Local time
Today, 11:32
Joined
Dec 2, 2009
Messages
6
Hey guys

Basically I have the following query, it's untested due to no data at the moment, but it looks fine IMO. Anyway my question is, would it be possible to return R.Description (TblResource.Description) where there isn't a inner join, e.g. where there is no corresponding value in the TblRsrcType table, as in the oppsite of an inner join kinda.

Anyway here's my current query below, hopefully I've manage to explain my question.

Code:
SELECT R.Description
FROM TblResource R
INNER JOIN TblRsrcEmp RSE
ON R.ResourceCode = RSE.ResourceCode
WHERE R.ResourceType = 'Laptop' 
AND RSE.Returned = 'Yes'
 
Hey guys

Basically I have the following query, it's untested due to no data at the moment, but it looks fine IMO. Anyway my question is, would it be possible to return R.Description (TblResource.Description) where there isn't a inner join, e.g. where there is no corresponding value in the TblRsrcType table, as in the oppsite of an inner join kinda.

Anyway here's my current query below, hopefully I've manage to explain my question.

Code:
SELECT R.Description
FROM TblResource R
INNER JOIN TblRsrcEmp RSE
ON R.ResourceCode = RSE.ResourceCode
WHERE R.ResourceType = 'Laptop' 
AND RSE.Returned = 'Yes'

This should work, do a left join including all R.Description where RSE.ResourceCode is null, meaning, no match.

Code:
SELECT R.Description
FROM TblResource R
LEFT JOIN TblRsrcEmp RSE
ON R.ResourceCode = RSE.ResourceCode
WHERE R.ResourceType = 'Laptop' 
AND RSE.Returned = 'Yes'
AND RSE.REsourceCode is null
 
Thanks for the query, I've tried it and used trial and error, but sadly I still can't get this working. It doesn't return records with the description 'Laptop' which are not in TblRsrcEmp. I've been racking my brain, thinking of maybe creating a view and select records that != the Laptop ID and still use the Returned = Yes,
but I think I'd still have the same problem.

Here's a print screen of the tables, note the query is using a different join / syntax since I've been trying numerous methods, hoping one would just work :).

w03pz4.png


Code:
SELECT R.Description
FROM TblResource AS R 
INNER JOIN TblRsrcEmp AS RSE
ON R.ResourceCode = RSE.ResourceCode 
WHERE (((R.ResourceType)= 'Laptop') 
AND ((RSE.Returned)='Yes')
OR ((RSE.ResourceCode) Is Null));


Here's
 

Users who are viewing this thread

Back
Top Bottom