Using Multiple Parameters in a Query

K

KAitchison

I have a question which probally has a simple answer but I am a bit stuck on
it..

I have a table which stores quite a bit of data over a long period of time..
I'm trying to write a query that will find records from today's date where
some fields have values above a set number.... right now its returning all
possible dates with fields with values above the set number....

So I want:
Date = Date()
AND 1 or more of the following conditions
%RustFungus >20 OR
%InsectInfestation >20 OR
%LeafCurling>20 OR... and so on

This is my SQL statement:

SELECT TM_Inspection_Data.Date, TM_Inspection_Data.[Tree Row],
TM_Inspection_Data.[% trees Green], TM_Inspection_Data.[% trees Yellow],
TM_Inspection_Data.[% trees Brown], TM_Inspection_Data.[% of trees with
Curling], TM_Inspection_Data.[% treeswith Rust Fungus], TM_Inspection_Data.[%
trees Insect Infestation], TM_Inspection_Data.[% trees Low],
TM_Inspection_Data.[% trees Med], TM_Inspection_Data.[% trees High],
TM_Inspection_Data.[% trees Rodent Impact], TM_Inspection_Data.[% trees
Branches through Gaurd], TM_Inspection_Data.[Comments(Inspection)],
TM_Inspection_Data.[% trees Irrigation System]

FROM TM_Inspection_Data

WHERE (((TM_Inspection_Data.Date)=Date()) AND ((TM_Inspection_Data.[%
treeswith Rust Fungus])>20) OR ((TM_Inspection_Data.[% trees Insect
Infestation])>20) OR ((TM_Inspection_Data.[% trees High])>20) OR
((TM_Inspection_Data.[% trees Rodent Impact])>20));


Can anyone suggest how to fix this to make it do what i want?? Thank you
Krista
 
K

KARL DEWEY

Try this --
WHERE (Date = Date()) AND ([%RustFungus] >20 OR [%InsectInfestation] >20 OR
[%LeafCurling] >20 OR... )
 
K

KAitchison

thank you that did the trick

KARL DEWEY said:
Try this --
WHERE (Date = Date()) AND ([%RustFungus] >20 OR [%InsectInfestation] >20 OR
[%LeafCurling] >20 OR... )

--
Build a little, test a little.


KAitchison said:
I have a question which probally has a simple answer but I am a bit stuck on
it..

I have a table which stores quite a bit of data over a long period of time..
I'm trying to write a query that will find records from today's date where
some fields have values above a set number.... right now its returning all
possible dates with fields with values above the set number....

So I want:
Date = Date()
AND 1 or more of the following conditions
%RustFungus >20 OR
%InsectInfestation >20 OR
%LeafCurling>20 OR... and so on

This is my SQL statement:

SELECT TM_Inspection_Data.Date, TM_Inspection_Data.[Tree Row],
TM_Inspection_Data.[% trees Green], TM_Inspection_Data.[% trees Yellow],
TM_Inspection_Data.[% trees Brown], TM_Inspection_Data.[% of trees with
Curling], TM_Inspection_Data.[% treeswith Rust Fungus], TM_Inspection_Data.[%
trees Insect Infestation], TM_Inspection_Data.[% trees Low],
TM_Inspection_Data.[% trees Med], TM_Inspection_Data.[% trees High],
TM_Inspection_Data.[% trees Rodent Impact], TM_Inspection_Data.[% trees
Branches through Gaurd], TM_Inspection_Data.[Comments(Inspection)],
TM_Inspection_Data.[% trees Irrigation System]

FROM TM_Inspection_Data

WHERE (((TM_Inspection_Data.Date)=Date()) AND ((TM_Inspection_Data.[%
treeswith Rust Fungus])>20) OR ((TM_Inspection_Data.[% trees Insect
Infestation])>20) OR ((TM_Inspection_Data.[% trees High])>20) OR
((TM_Inspection_Data.[% trees Rodent Impact])>20));


Can anyone suggest how to fix this to make it do what i want?? Thank you
Krista
 

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