in Education by
have a table of the list of problems people can have. These people are id'd by a number. These people can have any number of problems (usually 5-10). I want to get a list of the people that tobacco DOES NOT appear as a problem for them. My solution was going to be to make a query of the people that DO have tobacco problems, and then query that query with a statement to return the numbers that are NOT in the tobacco query. Is this easily done? Is this close? query to get list of people who DO have tobacco problems SELECT DISTINCT Person.PersonID FROM tblKentuckyCounties INNER JOIN (tblComorbidity INNER JOIN (Person INNER JOIN tblComorbidityPerson ON Person.PersonID = tblComorbidityPerson.personID) ON tblComorbidity.ID = tblComorbidityPerson.comorbidityFK) ON tblKentuckyCounties.ID = Person.County WHERE ((Not (tblComorbidity.comorbidityexplanation)="tobacco")); query I want to return the people NOT in the first query SELECT Person.PersonID AS Expr1, [Tobacco Query].PersonID FROM [Tobacco Query] INNER JOIN Person ON [Tobacco Query].PersonID = Person.PersonID; JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
I am not fully savvy on the Access SQL dialect, but what you want is a LEFT JOIN, not an INNER JOIN. A LEFT JOIN is like an INNER JOIN in that it will give you all rows from the left-hand side of the join (in this case, the Person table), joined to matching rows on the right-hand side of the join. But a LEFT JOIN will also give you the rows from the left-hand side that don't have matching rows on the right-hand side. For that subset of rows, the right-hand side columns will have NULL values. So you should be able to write: SELECT Person.PersonID AS Expr1, [Tobacco Query].PersonID FROM Person LEFT JOIN [Tobacco Query] ON [Tobacco Query].PersonID = Person.PersonID WHERE [Tobacco Query].PersonID IS NULL; That will eliminate every record except the ones for which you couldn't find a matching record in [Tobacco Query], which should be the ones you're looking for. Edit: Had the Person table on the right at first... with a LEFT JOIN it should be on the left, since that's the table you want the data from.

Related questions

0 votes
    have a table of the list of problems people can have. These people are id'd by a number. These ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 25, 2022 in Education by JackTerrance
0 votes
    How would make a news feed "friendly" database design, so that it wouldn't be extremely expensive to ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 11, 2022 in Education by JackTerrance
0 votes
    As of SQL Server 2005, you used to be able to open a flat file in SQL Management Studio off the ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 7, 2022 in Education by JackTerrance
0 votes
    As of SQL Server 2005, you used to be able to open a flat file in SQL Management Studio off the ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 6, 2022 in Education by JackTerrance
0 votes
    I am a developer for a .net application that uses ClickOnce for deployment. I have deployed it over 60 ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 21, 2022 in Education by JackTerrance
0 votes
    I have an integer field person_id with the default value of NULL. I am using a stored procedure and ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 25, 2022 in Education by JackTerrance
0 votes
    The SQL statement SELECT SUBSTR( 123456789', INSTR( abcabcabc','b'), 4) FROM EMP; prints (a) 6789 ... Answers, Database Interview Questions and Answers for Freshers and Experience...
asked Oct 11, 2021 in Education by JackTerrance
0 votes
    I need to change the status of my messages to Unseen and Seen, through telnet I have no problem ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 7, 2022 in Education by JackTerrance
0 votes
    Recently, I have started using Xcode 4 for developing iOS apps. In Xcode intellisense's autocomplete box, ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 2, 2022 in Education by JackTerrance
0 votes
    I have a simple NN model for detecting hand-written digits from a 28x28px image written in python using Keras: ... that actually means? Select the correct answer from above options...
asked Jan 28, 2022 in Education by JackTerrance
0 votes
    Taler nech 5 MOUS Section 1 of 1 Question # 5 By Default a JDBC Connection is in an autocommit mode Select the correct answer from above options...
asked Dec 23, 2021 in Education by JackTerrance
0 votes
    Write a program to accept a filename from the user and display all the lines from the file which contain python comment character ‘#’. Select the correct answer from above options...
asked Dec 21, 2021 in Education by JackTerrance
0 votes
    A csv file consists of missing values that are represented by hashtags (“#”) and ampersands (“&”). How can you read this type of a csv file in R?...
asked Oct 16, 2020 in Technology by JackTerrance
0 votes
    I'm trying to setup some friendly URLs on a SharePoint website. I know that I can do the ASP.Net ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 12, 2022 in Education by JackTerrance
0 votes
    I was wondering if there is a good way to hook into the Application_Start of a SharePoint 2007 site when ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 12, 2022 in Education by JackTerrance
...