V
v_roma
I apologize for reposting my question. It's actually a
follow-up question, which seems more complicated than the
original.
Once more, for the sake of simplification, let's say I
have a table with 4 fields: site, measurement date,
measurement type, and measurement result:
site / date / type / result
A / 95 / X / 1.0
A / 95 / Y / 1.2
A / 96 / Y / 1.3
B / 95 / X / 1.1
B / 95 / Y / 1.4
B / 96 / Y / 1.3
and so on... What I am trying to do is extract the
maximum result for each site/type combinantion and
extract the most recent result for each site/type
combination. So extracting the maximum results for the
example table above would give me something like
site / date / type / max_res
A / 95 / X / 1.0
A / 96 / Y / 1.3
B / 95 / X / 1.1
B / 96 / Y / 1.3
And extracting the most recent results would yield:
site / date / type / rec_res
A / 95 / X / 1.0
A / 96 / Y / 1.3
B / 95 / X / 1.1
B / 95 / Y / 1.4
This has been driving me crazy. My SQL knowledge is
somewhat poor, and I am pretty sure I need to do this in
SQL.
Thank you in advance!
follow-up question, which seems more complicated than the
original.
Once more, for the sake of simplification, let's say I
have a table with 4 fields: site, measurement date,
measurement type, and measurement result:
site / date / type / result
A / 95 / X / 1.0
A / 95 / Y / 1.2
A / 96 / Y / 1.3
B / 95 / X / 1.1
B / 95 / Y / 1.4
B / 96 / Y / 1.3
and so on... What I am trying to do is extract the
maximum result for each site/type combinantion and
extract the most recent result for each site/type
combination. So extracting the maximum results for the
example table above would give me something like
site / date / type / max_res
A / 95 / X / 1.0
A / 96 / Y / 1.3
B / 95 / X / 1.1
B / 96 / Y / 1.3
And extracting the most recent results would yield:
site / date / type / rec_res
A / 95 / X / 1.0
A / 96 / Y / 1.3
B / 95 / X / 1.1
B / 95 / Y / 1.4
This has been driving me crazy. My SQL knowledge is
somewhat poor, and I am pretty sure I need to do this in
SQL.
Thank you in advance!