query join with criteria fails, join not supported

I have a query that does not work.  I am trying return values in tblFixedAssets whether or not there are values in tblPulls, and it there are values in tblPull, they need to be tblPulledl.PullStatus <> '"O"

Access says join not supported.

SELECT DISTINCT tblFixedAssets.FixedAssetID
	,tblFixedAssets.fldBarCode
	,tblFixedAssets.Staff_ID
	,tblFixedAssets.Model
	,tblFixedAssets.fldAssetStatus
	,Inventory.[Item Number]
	,Inventory.fldNonBarCode
	,tblPulls.PulledStatus
FROM (
	tblFixedAssets INNER JOIN Inventory ON tblFixedAssets.Staff_ID = Inventory.[Item Number]
	)
LEFT JOIN tblPulls ON tblFixedAssets.fldBarCode = tblPulls.ItemBarCode
	AND tblpulls.pulledstatus <> "O"
WHERE tblFixedAssets.Staff_ID = 'Lens1.54-1.93-Evision'
	AND tblFixedAssets.fldAssetStatus = 'Active'

Open in new window


The join works in MSSQL.  With a change of the double quotes to single quotes.
pressMacAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

aikimarkCommented:
I would move this
AND tblpulls.pulledstatus <> "O"
down into the Where clause
Ryan ChongBusiness Systems Analyst , ex-Senior Application EngineerCommented:
you can try this:

SELECT DISTINCT tblFixedAssets.FixedAssetID
      ,tblFixedAssets.fldBarCode
      ,tblFixedAssets.Staff_ID
      ,tblFixedAssets.Model
      ,tblFixedAssets.fldAssetStatus
      ,Inventory.[Item Number]
      ,Inventory.fldNonBarCode
      ,tblPulls.PulledStatus
FROM (
      tblFixedAssets INNER JOIN Inventory ON tblFixedAssets.Staff_ID = Inventory.[Item Number]
      )
LEFT JOIN (select * from tblPulls where pulledstatus <> "O") as tblPulls ON tblFixedAssets.fldBarCode = tblPulls.ItemBarCode
WHERE tblFixedAssets.Staff_ID = 'Lens1.54-1.93-Evision'
      AND tblFixedAssets.fldAssetStatus = 'Active'

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Dale FyeOwner, Developing Solutions LLCCommented:
except that simply moving that criteria down into the WHERE clause will negate the LEFT JOIN.  You have to account for the NULLS (no match) in that field [PulledStatus].  You can do that with syntax like:

AND ( (tblpulls.pulledStatus IS NULL) OR (tblpulls.pulledstatus <> "O"))

but I prefer a syntax similar to:

AND NZ(tblpulls.pulledstatus, "") <> "O"


You might try:

SELECT DISTINCT tblFixedAssets.FixedAssetID
      ,tblFixedAssets.fldBarCode
      ,tblFixedAssets.Staff_ID
      ,tblFixedAssets.Model
      ,tblFixedAssets.fldAssetStatus
      ,Inventory.[Item Number]
      ,Inventory.fldNonBarCode
      ,tblPulls.PulledStatus
FROM (
      tblFixedAssets INNER JOIN Inventory ON tblFixedAssets.Staff_ID = Inventory.[Item Number]
      )
LEFT JOIN tblPulls ON tblFixedAssets.fldBarCode = tblPulls.ItemBarCode
WHERE tblFixedAssets.Staff_ID = 'Lens1.54-1.93-Evision'
      AND tblFixedAssets.fldAssetStatus = 'Active'
      AND NZ(tblpulls.pulledstatus, "") <> "O"
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

Brian CroweDatabase AdministratorCommented:
You need to alias your subquery but honestly it doesn't appear as if you really need it set up as one anyway

SELECT DISTINCT A.FixedAssetID
	,A.fldBarCode
	,A.Staff_ID
	,A.Model
	,A.fldAssetStatus
	,I.[Item Number]
	,I.fldNonBarCode
	,P.PulledStatus
FROM tblFixedAssets AS A
INNER JOIN Inventory AS I
   ON tblFixedAssets.Staff_ID = Inventory.[Item Number]
LEFT JOIN tblPulls AS P
   ON A.fldBarCode = P.ItemBarCode
   AND P.pulledstatus <> "O"
WHERE A.Staff_ID = 'Lens1.54-1.93-Evision'
	AND A.fldAssetStatus = 'Active'

Open in new window

Vitor MontalvãoMSSQL Senior EngineerCommented:
pressMac, do you still need help with this question?
pressMacAuthor Commented:
Sorry It took so long, but that makes it work.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.