adjust logic

This commit is contained in:
Erik Eckert 2023-09-15 16:19:24 -06:00
parent 0b982dba10
commit 57487d9e31
2 changed files with 14 additions and 24 deletions

View File

@ -34,7 +34,6 @@ where Project not in (
Select Project Select Project
from DuplicateList from DuplicateList
) )
AND Parent not in ( AND Parent NOT in (select B.Parent from NonDupParent as B)
Select Parent order by Server
from NonDupParent ;
);

View File

@ -4,33 +4,24 @@ CREATE TABLE DataInventory AS
Select * Select *
from ( from (
SELECT SERVER, SELECT SERVER,
Parent,
REPLACE( REPLACE(
Parent, Parent,
"X:\","\\mpe.ca\datadrive\") AS UNCPath, "X:\","\\mpe.ca\datadrive\") AS UNCPath,
REPLACE(REPLACE(Parent,("X:\" || Server),"/Shared/N-Data"),"\","/") AS EgnytePath, REPLACE(REPLACE(Parent,("X:\" || Server),"/Shared/N-Data"),"\","/") AS EgnytePath,
sum(FileCount) as FileCount, Sum(FileSize) as FileSize, 'Parent' as Source from FolderData sum(FileCount) as FileCount, Sum(FileSize) as FileSize, 'Parent' as Source from FolderData
Where Parent != ( Where Parent in (
SELECT Parent FROM DuplicateList SELECT Parent FROM NonDupParent
) )
GROUP by UNCPath GROUP by UNCPath
) )
UNION
SELECT SERVER, Parent, union
SELECT SERVER,
REPLACE(PATH,"X:\","\\mpe.ca\datadrive\") AS UNCPath, REPLACE(PATH,"X:\","\\mpe.ca\datadrive\") AS UNCPath,
REPLACE(REPLACE(PATH,("X:\" || Server),"/Shared/N-Data"),"\","/") AS EgnytePath, REPLACE(REPLACE(PATH,("X:\" || Server),"/Shared/N-Data"),"\","/") AS EgnytePath,
FileCount, FileSize, 'Project' as Source from FolderData FileCount, FileSize, Project as Source from FolderData
Where FolderData.Project NOT in ( Where FolderData.Project in (
SELECT A.Project FROM DuplicateList as A) SELECT Project FROM NonDupProject)
AND FolderData.Parent in ( -- AND FolderData.Parent in (
Select B.Parent FROM DuplicateList as B -- Select Parent FROM NonDupParent
); -- );
delete FROM DataInventory
where Parent in (
select Parent from DataInventory
group by Parent
HAVING count(*) > 1
)
and Source = 'Project';