A family of Microsoft relational database management systems designed for ease of use.
Is this what you want?
WHERE NOT(State = "Texas" AND [Retail Funds] IS NOT NULL)
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I would like my query results to not display BKCL in Texas. How should I construct my query?
| Fund | State | Code | Assets |
|---|---|---|---|
| 0005 | Texas | BKCL | 160.00 |
| 0007 | Texas | BKCL | 188.00 |
| 0009 | New York | BKCL | 155.00 |
| 0002 | New York | CORP | 125.00 |
| 0003 | Texas | CORP | 130.00 |
| 0010 | Florida | RETI | 200.00 |
| 0004 | Georgia | TRST | 150.00 |
| 0008 | Maine | TRST | 177.00 |
A family of Microsoft relational database management systems designed for ease of use.
Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.
Answer accepted by question author
Is this what you want?
WHERE NOT(State = "Texas" AND [Retail Funds] IS NOT NULL)
Answer accepted by question author
Mea culpa! It should have been:
SELECT *
FROM [YourTableNameGoesHere]
WHERE NOT(State = "Texas"
AND Code = "BKCL");
As I'd written it the Boolean AND operations required both columns to be NOT equal to the values, whereas what's needed is for both columns to be equal to the stated values, and then for the NOT operation to be applied to the result of the AND operation, which is what the above statement does.
It can also be expressed as a Boolean OR operation:
SELECT *
FROM [YourTableNameGoesHere]
WHERE State <> "Texas"
OR Code <> "BKCL");
Thank you Ken for the reply.. however the results did not include "New York" and "BKCL". I have attached the query results based on your recommendation. I am not sure if this possible but the query needs to not bring in "Texas" when the code is "BKCL".
| 0002 | New York | CORP | 125.00 |
|---|---|---|---|
| 0010 | Florida | RETI | 200.00 |
| 0004 | Georgia | TRST | 150.00 |
| 0008 | Maine | TRST | 177.00 |
I would like my query results to not display BKCL in Texas. How should I construct my query?
Along these lines:
SELECT *
FROM [YourTableNameGoesHere]
WHERE State <> "Texas"
AND Code <> "BKCL";
So the results should be;
| Fund | State | Code | Assets |
|---|---|---|---|
| 0009 | New York | BKCL | 155.00 |
| 0002 | New York | CORP | 125.00 |
| 0003 | Nebraska | CORP | 130.00 |
| 0010 | Florida | RETI | 200.00 |
| 0004 | Georgia | TRST | 150.00 |
| 0008 | Maine | TRST | 177.00 |