Solved Query with multiple criteria (1 Viewer)

hrdpgajjar

Registered User.
Local time
Today, 22:58
Joined
Sep 24, 2019
Messages
70
Hi all,
I am trying to generate data with following criteria in my database,

1. File sent column = is null
2. Status column = Not equals to "return" or Is null
3. Physical file column = Not equals "IN QUERY"

here is my query in SQL VIEW,
SELECT [App Data].[Regi No], [App Data].[Farmer Name], [App Data].Area, [App Data].[Sent To BRD], [App Data].Status, [App Data].[Physical File At] FROM [App Data] WHERE ((([App Data].[Sent To BRD]) Is Null) AND (([App Data].Status)<>"Return to field" Or ([App Data].Status) Is Null) AND (([App Data].[Physical File At])<>"IN QUERY"));

it shows zero in result,

If i make change as physical file column = "IN QUERY" then it shows only files in query


What i want is to fulfill all three criteria's. I need list of cases where,

1. File sent column = is null
2. Status column = Not equals to "return" or Is null
3. Physical file column = Not equals "IN QUERY"


pls help

Thank You,
 
Have you tried using the query builder - looks like your brackets may be incorrectly paired.

or remove all the brackets and just replace them around the second requirement
 
Have you tried using the query builder - looks like your brackets may be incorrectly paired.

or remove all the brackets and just replace them around the second requirement
This is the result from Query builder itself. I have not tried to change anything.
 
In that case, implies you don’t have any data to fit the criteria
 
if you remove all the brackets and replace just around criteria 2 (the OR) I would expect it to look like this

SQL:
SELECT [App Data].[Regi No], [App Data].[Farmer Name], [App Data].Area, [App Data].[Sent To BRD], [App Data].Status, [App Data].[Physical File At]
FROM [App Data]
WHERE [App Data].[Sent To BRD] Is Null AND ([App Data].Status<>"Return to field" Or [App Data].Status Is Null) AND [App Data].[Physical File At]<>"IN QUERY"

Generally speaking, bad idea to have spaces in table and field names - makes the code harder to read and forces the requirement to use square brackets
 

Users who are viewing this thread

Back
Top Bottom