Help with simple query!

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi everyone
I've been trying to figure out how to do this query. I have a table and let's say it has three fields: site name, type of measurement, measurement result. One site name will show up in several lines (for every type of measurement done at the site). I want to query the table so that I get all the different site names where at least one of the following measurement types, temperature and humidity, is not equal to zero (just an example!). But, along with the site names, I also want it to show the remaining of the site's measurements and results (even if they are diferent than zero), as long as either the temperature or the humidity are zero. I can create a query to give me the site names that fit the parameters, but how do I get it to show the rest of the results as well? Should I then use that list to re-query the main table for the rest of the results? How? Is there an easier way to do this
I hope I have made myself clear. Any help would be appreciated
Thanks!
 
I would build two queries. Sounds like you have already built the first
one. That pulls the sites you want. Now you need to create a new query.
Add your table and the first query we discussed. Set your relationship so
that it pulls all records from the table where a record exists with the same
site in the query.

Post back if you need more details.

Rick B


Hi everyone,
I've been trying to figure out how to do this query. I have a table and
let's say it has three fields: site name, type of measurement, measurement
result. One site name will show up in several lines (for every type of
measurement done at the site). I want to query the table so that I get all
the different site names where at least one of the following measurement
types, temperature and humidity, is not equal to zero (just an example!).
But, along with the site names, I also want it to show the remaining of the
site's measurements and results (even if they are diferent than zero), as
long as either the temperature or the humidity are zero. I can create a
query to give me the site names that fit the parameters, but how do I get it
to show the rest of the results as well? Should I then use that list to
re-query the main table for the rest of the results? How? Is there an
easier way to do this?
I hope I have made myself clear. Any help would be appreciated.
Thanks!
 
Thanks for the reply, Rick. I am still having problems
though, because the first query will return duplicate
values for the site name. Is there any way to have the
query return only one occurence of each name?
Thanks again,
Vasco
 
Ok, I figured that part out. I now have a table that
contains my sites of interest (in my previous example,
the ones that either the temperature or humidity were not
zero), along with all the remaining measurements (whether
they were zero or not). This table also has the date of
the measurement.

My next problem is how to pull out the highest
measurement for each combination of site and measurement
type, and the most recent measurement for each
combination of site and measurement. For example, for
site A and measurement of temperature, I would need the
most recent and the highest result (where site A has
several types of measurements... temperature, humidity,
pressure, etc). Any ideas?

Thanks much!
 
Back
Top