D
Dick Watson
By way of example, I have a table of data points named test:
dataset x y
1 1.5 0.5
1 1.7 0.3
1 1.8 -0.2
1 1.9 -0.5
2 2.8 0.9
2 2.9 0.3
2 3.1 -0.25
2 3.3 -0.75
I have a query:
SELECT test.dataset, Min(test.y) AS MinPos_y
FROM test
WHERE (((test.y)>0))
GROUP BY test.dataset;
But the problem is that I need to know the test.x values that were
associated with those test.y values identified as the Min value greater than
0.
Obviously, this doesn't work since test.x is not part of the agregate, but
also obvioulsy, I cannot group on test.x and get the desired result:
SELECT test.dataset, test.x, Min(test.y) AS MinPos_y
FROM test
WHERE (((test.y)>0))
GROUP BY test.dataset;
I've tried various forms of queries that look, simplified, like this:
SELECT datasets.dataset, DLookUp("x","SELECT test.dataset, Min(test.y) AS
MinOfy
FROM test
WHERE (((test.y)>0))
GROUP BY test.dataset","dataset = " & [datasets].[dataset]) AS MinPos_y
FROM [SELECT DISTINCT test.dataset
FROM test]. AS datasets;
or things similar to this:
SELECT datasets.dataset,
(SELECT x
FROM test
WHERE (((test.y)=[MinPos_y]) AND ((test.dataset)=datasets.dataset))) AS x,
(SELECT Min(test.y) AS MinPos_y
FROM test
WHERE (((test.y)>0) AND ((test.dataset)=datasets.dataset))
GROUP BY test.dataset) AS MinPos_y
FROM [SELECT DISTINCT test.dataset
FROM test]. AS datasets;
All to No Joy.
Any hints how to get the x and aggregated y values back together again?
Thanks in advance!
dataset x y
1 1.5 0.5
1 1.7 0.3
1 1.8 -0.2
1 1.9 -0.5
2 2.8 0.9
2 2.9 0.3
2 3.1 -0.25
2 3.3 -0.75
I have a query:
SELECT test.dataset, Min(test.y) AS MinPos_y
FROM test
WHERE (((test.y)>0))
GROUP BY test.dataset;
But the problem is that I need to know the test.x values that were
associated with those test.y values identified as the Min value greater than
0.
Obviously, this doesn't work since test.x is not part of the agregate, but
also obvioulsy, I cannot group on test.x and get the desired result:
SELECT test.dataset, test.x, Min(test.y) AS MinPos_y
FROM test
WHERE (((test.y)>0))
GROUP BY test.dataset;
I've tried various forms of queries that look, simplified, like this:
SELECT datasets.dataset, DLookUp("x","SELECT test.dataset, Min(test.y) AS
MinOfy
FROM test
WHERE (((test.y)>0))
GROUP BY test.dataset","dataset = " & [datasets].[dataset]) AS MinPos_y
FROM [SELECT DISTINCT test.dataset
FROM test]. AS datasets;
or things similar to this:
SELECT datasets.dataset,
(SELECT x
FROM test
WHERE (((test.y)=[MinPos_y]) AND ((test.dataset)=datasets.dataset))) AS x,
(SELECT Min(test.y) AS MinPos_y
FROM test
WHERE (((test.y)>0) AND ((test.dataset)=datasets.dataset))
GROUP BY test.dataset) AS MinPos_y
FROM [SELECT DISTINCT test.dataset
FROM test]. AS datasets;
All to No Joy.
Any hints how to get the x and aggregated y values back together again?
Thanks in advance!