Solved Query with multiple criteria (1 Viewer)

hrdpgajjar

Registered User.
Local time
Tomorrow, 03:15
Joined
Sep 24, 2019
Messages
53
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,
 

CJ_London

Super Moderator
Staff member
Local time
Today, 22:45
Joined
Feb 19, 2013
Messages
16,712
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
 

hrdpgajjar

Registered User.
Local time
Tomorrow, 03:15
Joined
Sep 24, 2019
Messages
53
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.
 

CJ_London

Super Moderator
Staff member
Local time
Today, 22:45
Joined
Feb 19, 2013
Messages
16,712
In that case, implies you don’t have any data to fit the criteria
 

CJ_London

Super Moderator
Staff member
Local time
Today, 22:45
Joined
Feb 19, 2013
Messages
16,712
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

Top Bottom