Having troubles with my Query not producing desired results

Wag2016

Registered User.
Local time
Yesterday, 23:10
Joined
Mar 5, 2016
Messages
24
Hi all, happy Saturday.

I'm working from home on a deadline to get this database into production on Monday. It has been in testing for two weeks now and I found a lot of issues.

Here is one of them, I struggle with sql.

Here is the sql I have:

Code:
SELECT [tbl_QualityChecklist].*, *
 
FROM [tbl_QualityChecklist] LEFT JOIN tbl_Turnbacks ON [tbl_QualityChecklist].CID = tbl_Turnbacks.CID
 
WHERE ((([tbl_QualityChecklist].Username)=fOSUserName()) AND (([tbl_QualityChecklist].QuoteApp)=False) AND (([tbl_QualityChecklist].MgrApp)=False) AND (([tbl_QualityChecklist].Archive)=False)) 
  
 OR ((([tbl_QualityChecklist].Username)=fOSUserName()) AND ((tbl_Turnbacks.TurnbackOn)=True));
I broke it up so it is easier to read. What I am trying to do it pull all records that are owned by fOSUserName, and are false in QuoteApp, MgrApp and Archive. I also want to show any records owned by fOSUserName and that are True in the Turnback table.

Where am I going wrong?

Thank you!
 
I forgot to mention the problem! I keep seeing Archived records when they should have been excluded by the false.
 
Ok, folks I found the problem. It was in the sample data. It would not archive because it had a turnback.

Sorry to bother you! Thanks!
 

Users who are viewing this thread

Back
Top Bottom