First of all I am using Oracle 10g Express
So there are three columns I want to select:
[domain_name] [index_path] [collection_name]
Now there are two columns that I want to be unique (as a group):
[domain_name] [index_path]
And then I want to select the row baised on when another column [gen_timestamp] is most recent.
So my issue is how do I basically:
SELECT domain_name, index_path, MIN(collection_name) collection_name
FROM TABLENAMEHERE
GROUP BY domain_name, index_path;
but instead of selecting the min collection_name, select the row were [gen_timestamp] is the most recent.
To clarify a few questions I could see people asking:
Do you need a unique value of domain_name, AND a unique value of index_path, or a unique COMBINATION of the two?
unique COMBINATION of the two.
So there are multiple rows of the same [domain_name] [index_path]?
Yes.
This is the code that I am working with now but it doesn't quite work:
select domain_name, index_path, collection_name
from my_table outr
inner join
(select domain_name, index_path, collection_name,
max(gen_timestamp)
over (partition by domain_name, index_path) gen_timestamp
from my_table) innr
where outr.domain_name = innr.domain_name
and outr.index_path = innr.index_path
and outr.collection_name = innr.collection_name
and outr.gen_timestamp = innr.gen_timestamp