Filtering on two criteria in table search

J

Johnny

Hi . I have a query that delivers fields from my table. But I need to filter
on two words in one field. The SQL for 1 expression looks as follows:
SELECT TABLE.ID, TABLE.E, TABLE.G, TABLE.Q, TABLE.V, TABLE.X
FROM

WHERE (((TABLE.E)="1") AND ((TABLE.G)="Type") AND ((TABLE.Q) Like "*Job
Close*") AND ((TABLE.V)="Dispatch") AND ((TABLE.X)<>"Telephone"));

This works fine. When I add a Or to my Table.X field I get the following
SELECT TABLE.ID, TABLE.E, TABLE.G, TABLE.Q, TABLE.V, TABLE.X
FROM

WHERE (((TABLE.E)="1") AND ((TABLE.G)="Type") AND ((TABLE.Q) Like "*Job
Close*") AND ((TABLE.V)="Dispatch") AND ((TABLE.X)<>"Telephone" Or
(TABLE.X)="Customer"));

This now returns records containing both the words I am trying to filter out
in my Query (Telephone & Customer). Any idea where I am going wrong?
 
J

JaRa

What do you expect as result of this query?

Should it only give Customers or should it give all records which are not
Telephone

- Raoul
 
J

Johnny

JaRa. I entered the last part incorrectly when typing in the SQL in my
question. it should be <> Telephone OR <> Customer. I want to return all
records that do not contain those words.

JaRa said:
What do you expect as result of this query?

Should it only give Customers or should it give all records which are not
Telephone

- Raoul

Johnny said:
Hi . I have a query that delivers fields from my table. But I need to filter
on two words in one field. The SQL for 1 expression looks as follows:
SELECT TABLE.ID, TABLE.E, TABLE.G, TABLE.Q, TABLE.V, TABLE.X
FROM

WHERE (((TABLE.E)="1") AND ((TABLE.G)="Type") AND ((TABLE.Q) Like "*Job
Close*") AND ((TABLE.V)="Dispatch") AND ((TABLE.X)<>"Telephone"));

This works fine. When I add a Or to my Table.X field I get the following
SELECT TABLE.ID, TABLE.E, TABLE.G, TABLE.Q, TABLE.V, TABLE.X
FROM

WHERE (((TABLE.E)="1") AND ((TABLE.G)="Type") AND ((TABLE.Q) Like "*Job
Close*") AND ((TABLE.V)="Dispatch") AND ((TABLE.X)<>"Telephone" Or
(TABLE.X)="Customer"));

This now returns records containing both the words I am trying to filter out
in my Query (Telephone & Customer). Any idea where I am going wrong?
 
J

JaRa

then the OR should be AND because you want all the conditions

- Raoul


Johnny said:
JaRa. I entered the last part incorrectly when typing in the SQL in my
question. it should be <> Telephone OR <> Customer. I want to return all
records that do not contain those words.

JaRa said:
What do you expect as result of this query?

Should it only give Customers or should it give all records which are not
Telephone

- Raoul

Johnny said:
Hi . I have a query that delivers fields from my table. But I need to filter
on two words in one field. The SQL for 1 expression looks as follows:
SELECT TABLE.ID, TABLE.E, TABLE.G, TABLE.Q, TABLE.V, TABLE.X
FROM

WHERE (((TABLE.E)="1") AND ((TABLE.G)="Type") AND ((TABLE.Q) Like "*Job
Close*") AND ((TABLE.V)="Dispatch") AND ((TABLE.X)<>"Telephone"));

This works fine. When I add a Or to my Table.X field I get the following
SELECT TABLE.ID, TABLE.E, TABLE.G, TABLE.Q, TABLE.V, TABLE.X
FROM

WHERE (((TABLE.E)="1") AND ((TABLE.G)="Type") AND ((TABLE.Q) Like "*Job
Close*") AND ((TABLE.V)="Dispatch") AND ((TABLE.X)<>"Telephone" Or
(TABLE.X)="Customer"));

This now returns records containing both the words I am trying to filter out
in my Query (Telephone & Customer). Any idea where I am going wrong?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top