turkishgold
Registered User.
- Local time
- Today, 14:11
- Joined
- Aug 25, 2009
- Messages
- 17
Hi,
I'm trying to devise a query which will result in showing records based on result values that equal another distributing sources result values. So, I want to select the result values from the table from a particular "agency", and then based on that subquery, use that to narrow down the results from a similar query. I'm trying to resolve duplicate "result" values between these two "distributing agencies" for the purpose of doing Quality Control on a water quality database compilation. I'd only like to see records from one distributing agency where the result value equals a result value associated with a record from the other distributing agency (trying to resolve duplicates between two agencies at a time). Hopefully this makes sense...
This is what I have:
any help would be greatly appreciated!
I tried to run the above query, and Access just seems to be hung now.
I had the below query which works, but I tried to take it and further refine the records returned based on what I describe as my goal above:
thanks for any help/insight
Tom
I'm trying to devise a query which will result in showing records based on result values that equal another distributing sources result values. So, I want to select the result values from the table from a particular "agency", and then based on that subquery, use that to narrow down the results from a similar query. I'm trying to resolve duplicate "result" values between these two "distributing agencies" for the purpose of doing Quality Control on a water quality database compilation. I'd only like to see records from one distributing agency where the result value equals a result value associated with a record from the other distributing agency (trying to resolve duplicates between two agencies at a time). Hopefully this makes sense...
This is what I have:
Code:
SELECT Sample.site_id, Sample.dt_tm, Salinity.sample_id, Salinity.result_value, Salinity.distributing_agency, Salinity.param_code, Sample.collecting_agency
FROM Salinity INNER JOIN Sample on Salinity.sample_id = sample.sample_id
WHERE Sample.site_id
In (SELECT Sample.site_id FROM Sample WHERE Salinity.distributing_agency = 8 AND (Salinity.result_value In (Select Salinity.result_value From Salinity WHERE Salinity.distributing_agency = 6))
GROUP BY [Sample.site_id],[Sample.dt_tm] HAVING Count(*)>1 And Sample.dt_tm = Sample.dt_tm;)
ORDER BY Salinity.result_value, Salinity.distributing_agency, Sample.dt_tm, Sample.site_id;
any help would be greatly appreciated!
I tried to run the above query, and Access just seems to be hung now.
I had the below query which works, but I tried to take it and further refine the records returned based on what I describe as my goal above:
Code:
SELECT Sample.site_id, Sample.dt_tm, Salinity.sample_id, Salinity.result_value, Salinity.distributing_agency, Salinity.param_code, Sample.collecting_agency
FROM Salinity INNER JOIN Sample on Salinity.sample_id = sample.sample_id
WHERE Sample.[site_id]
In (SELECT [Sample.site_id] FROM [Sample] INNER JOIN Salinity On Sample.sample_id = Salinity.sample_id WHERE Salinity.distributing_agency = 8 OR Salinity.distributing_agency = 6
GROUP BY [Sample.site_id],[Sample.dt_tm] HAVING Count(*)>1 And Sample.dt_tm = Sample.dt_tm;)
ORDER BY Salinity.result_value, Sample.dt_tm, Salinity.distributing_agency, Sample.site_id;
thanks for any help/insight
Tom