By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,656 Members | 1,779 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,656 IT Pros & Developers. It's quick & easy.

query filter using many fields

P: n/a
hi,
hope someone can help me. i am a newbie in creating queries and i
want to create a query wherein i only get entries from my table where
values of fields 2, 3 and 4 are not zeros. for example:
field1 field2 field3 field4
one 1 0 0
two 2 0 3
three 0 0 0

my query should only get entries one and two. can somebody show me
how to do this? thanks a lot.

nick_faye
Nov 13 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Hi Nick
In your query select all your fields and in the first row of the criteria
under "field2" type <>0. In the second row of the criteria under "field3"
type <>0. In the third row of the criteria under "field4" type <>0.

The SQL should look like this
SELECT YourTable.Field1, YourTable.Field2, YourTable.Field3,
YourTable.Field4
FROM YourTable
WHERE (((YourTable.Field2)<>0)) OR (((YourTable.Field3)<>0)) OR
(((YourTable.Field4)<>0));

Stewart
"nick_faye" <iv******@yahoo.com> wrote in message
news:8a*************************@posting.google.co m...
hi,
hope someone can help me. i am a newbie in creating queries and i
want to create a query wherein i only get entries from my table where
values of fields 2, 3 and 4 are not zeros. for example:
field1 field2 field3 field4
one 1 0 0
two 2 0 3
three 0 0 0

my query should only get entries one and two. can somebody show me
how to do this? thanks a lot.

nick_faye

Nov 13 '05 #2

P: n/a
hey thank you for your suggestion... i'll try this one... actually i
have tried doing this but the SQL generates an 'AND' and not 'OR'...
i wonder why... maybe because i typed the '<>0' at the 'criteria' row
of my fields?

"Stewart Allen" <sa****@NOT.wave.THIS.co.nz> wrote in message news:<c9**********@news.wave.co.nz>...
Hi Nick
In your query select all your fields and in the first row of the criteria
under "field2" type <>0. In the second row of the criteria under "field3"
type <>0. In the third row of the criteria under "field4" type <>0.

The SQL should look like this
SELECT YourTable.Field1, YourTable.Field2, YourTable.Field3,
YourTable.Field4
FROM YourTable
WHERE (((YourTable.Field2)<>0)) OR (((YourTable.Field3)<>0)) OR
(((YourTable.Field4)<>0));

Stewart
"nick_faye" <iv******@yahoo.com> wrote in message
news:8a*************************@posting.google.co m...
hi,
hope someone can help me. i am a newbie in creating queries and i
want to create a query wherein i only get entries from my table where
values of fields 2, 3 and 4 are not zeros. for example:
field1 field2 field3 field4
one 1 0 0
two 2 0 3
three 0 0 0

my query should only get entries one and two. can somebody show me
how to do this? thanks a lot.

nick_faye

Nov 13 '05 #3

P: n/a
iv******@yahoo.com (nick_faye) wrote in
news:8a**************************@posting.google.c om:
hey thank you for your suggestion... i'll try this one...
actually i have tried doing this but the SQL generates an
'AND' and not 'OR'... i wonder why... maybe because i typed
the '<>0' at the 'criteria' row of my fields?
There are several criteria rows in the query design grid.Putting
multiple criteria on the same row puts AND between each criteria.
Putting them on separate rows puts OR between them.

Bob Quintal
"Stewart Allen" <sa****@NOT.wave.THIS.co.nz> wrote in message
news:<c9**********@news.wave.co.nz>...
Hi Nick
In your query select all your fields and in the first row of
the criteria under "field2" type <>0. In the second row of
the criteria under "field3" type <>0. In the third row of the
criteria under "field4" type <>0.

The SQL should look like this
SELECT YourTable.Field1, YourTable.Field2, YourTable.Field3,
YourTable.Field4
FROM YourTable
WHERE (((YourTable.Field2)<>0)) OR (((YourTable.Field3)<>0))
OR (((YourTable.Field4)<>0));

Stewart
"nick_faye" <iv******@yahoo.com> wrote in message
news:8a*************************@posting.google.co m...
> hi,
> hope someone can help me. i am a newbie in creating
> queries and i
> want to create a query wherein i only get entries from my
> table where values of fields 2, 3 and 4 are not zeros. for
> example:
> field1 field2 field3 field4
> one 1 0 0
> two 2 0 3
> three 0 0 0
>
> my query should only get entries one and two. can somebody
> show me how to do this? thanks a lot.
>
> nick_faye


Nov 13 '05 #4

P: n/a
While in the SQL view change all the 'AND' to 'OR' , then change back to the
design view and see where all the '<>0' are placed. Bob mentioned that there
are several (multiple) criteria rows and that's what I meant by second row
and third row.

Stewart

"nick_faye" <iv******@yahoo.com> wrote in message
news:8a**************************@posting.google.c om...
hey thank you for your suggestion... i'll try this one... actually i
have tried doing this but the SQL generates an 'AND' and not 'OR'...
i wonder why... maybe because i typed the '<>0' at the 'criteria' row
of my fields?

"Stewart Allen" <sa****@NOT.wave.THIS.co.nz> wrote in message

news:<c9**********@news.wave.co.nz>...
Hi Nick
In your query select all your fields and in the first row of the criteria under "field2" type <>0. In the second row of the criteria under "field3" type <>0. In the third row of the criteria under "field4" type <>0.

The SQL should look like this
SELECT YourTable.Field1, YourTable.Field2, YourTable.Field3,
YourTable.Field4
FROM YourTable
WHERE (((YourTable.Field2)<>0)) OR (((YourTable.Field3)<>0)) OR
(((YourTable.Field4)<>0));

Stewart
"nick_faye" <iv******@yahoo.com> wrote in message
news:8a*************************@posting.google.co m...
hi,
hope someone can help me. i am a newbie in creating queries and i
want to create a query wherein i only get entries from my table where
values of fields 2, 3 and 4 are not zeros. for example:
field1 field2 field3 field4
one 1 0 0
two 2 0 3
three 0 0 0

my query should only get entries one and two. can somebody show me
how to do this? thanks a lot.

nick_faye

Nov 13 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.