Query with Multiple Criteria

utzja1

Registered User.
Local time
Today, 17:59
Joined
Oct 18, 2012
Messages
97
Hi, I'm sure this is a simple question but it has bedeviled me this afternoon. I am assembling a database for a client that involves some inspection efforts at several hundred locations around the county. We have completed inspections and are now looking at ways to parse the data to make sure our recommendations to the client are targeting the most critical deficiencies. We are in the prioritization phase and am looking to apply multiple criteria to a query. I added one criteria and it worked perfectly, when I added another criteria, it's not being recognized and I'm seeing essentially the same data set as the first query. Here is the SQL statement:

SELECT [Table1].CRS01, [Table1].[Street 1], [Table1].[Street 2], Table2.GD04, [Table1].AnchorBoltsComment, Table3.CS02
FROM Table3 INNER JOIN (Table1 LEFT JOIN Table2 ON [Table1].NumBolts = Table1.NumAnchBoltsCode) ON Table3.CvrInspCode = [Table1].TeamLead
WHERE ((([Table1].TeamLead)=1) AND (([Table1].AnchorBoltsComment) Like "*unable*") AND (([Table1].InspReqd2015)=Yes)) OR ((([Table1].AnchorBoltsComment) Like "*not*"))
ORDER BY [Table1].CRS01;

For this exercise, I ran into the issue when I added the WHERE ([Table1].TeamLead) = 1 statement. The other WHERE clause, where I was fishing for specific text in the comments, worked fine.

Thanks for your time!
 
Please demonstrate your issue with data. Provide 2 sets:

A. Starting date from your tables. Include table and field names and enough sample data to cover all cases.

B. Expected results when using A. Show us what your query should return when you use the data from A.
 
Thank you for your prompt response. I manged to figure it out this morning; the problem was in my first criteria where I was searching for certain strings within the comments. The SQL syntax looked odd to me, so I cleared the criteria field in the Design view and then re-wrote a proper OR statement. It works like a charm now.
 

Users who are viewing this thread

Back
Top Bottom