I am trying to run a query to build a list of folders (and their hierarchy) which contain content whose content have been viewed within a specified time period. I'm running the following query, but it returns the same folder multiple times and at various levels (see below). I thought the "distinct" would take care of that. FYI 769212 is the dataid for "Kick-Off Presentations".
select distinct a.dataid, a.name, sys_connect_by_path(a.name,':') from dtree a, dauditnew c where a.dataid=c.dataid and
a.dataid in (select a.parentid from dtree a, dauditnew c where c.dataid=a.dataid and c.auditstr = 'Fetch' and c.auditdate < '01-JAN-14' start with a.dataid=769212 connect by a.parentid = prior a.dataid) connect by a.parentid = prior a.dataid
RESULTS:
"DATAID" "NAME" "SYS_CONNECT_BY_PATH(A.NAME,':')"
"769212" "Kick-Off Presentations" ":Kick-Off Presentations"
"769212" "Kick-Off Presentations" ":Regional Markets Group (Puckett):Marketing (Lal):Kick-Off Presentations"
"769212" "Kick-Off Presentations" ":Marketing (Lal):Kick-Off Presentations"