diff --git a/GenTables.sql b/GenTables.sql index 163cd2d..b2a126f 100644 --- a/GenTables.sql +++ b/GenTables.sql @@ -34,7 +34,6 @@ where Project not in ( Select Project from DuplicateList ) - AND Parent not in ( - Select Parent - from NonDupParent - ); \ No newline at end of file +AND Parent NOT in (select B.Parent from NonDupParent as B) +order by Server +; \ No newline at end of file diff --git a/Generate Egnyte Export.sql b/Generate Egnyte Export.sql index 5bd1ec8..8f72500 100644 --- a/Generate Egnyte Export.sql +++ b/Generate Egnyte Export.sql @@ -4,33 +4,24 @@ CREATE TABLE DataInventory AS Select * from ( SELECT SERVER, - Parent, REPLACE( Parent, "X:\","\\mpe.ca\datadrive\") AS UNCPath, REPLACE(REPLACE(Parent,("X:\" || Server),"/Shared/N-Data"),"\","/") AS EgnytePath, sum(FileCount) as FileCount, Sum(FileSize) as FileSize, 'Parent' as Source from FolderData - Where Parent != ( - SELECT Parent FROM DuplicateList + Where Parent in ( + SELECT Parent FROM NonDupParent ) GROUP by UNCPath ) -UNION -SELECT SERVER, Parent, + +union +SELECT SERVER, REPLACE(PATH,"X:\","\\mpe.ca\datadrive\") AS UNCPath, REPLACE(REPLACE(PATH,("X:\" || Server),"/Shared/N-Data"),"\","/") AS EgnytePath, - FileCount, FileSize, 'Project' as Source from FolderData -Where FolderData.Project NOT in ( - SELECT A.Project FROM DuplicateList as A) -AND FolderData.Parent in ( - Select B.Parent FROM DuplicateList as B - ); - - -delete FROM DataInventory -where Parent in ( - select Parent from DataInventory - group by Parent - HAVING count(*) > 1 - ) -and Source = 'Project'; \ No newline at end of file + FileCount, FileSize, Project as Source from FolderData +Where FolderData.Project in ( + SELECT Project FROM NonDupProject) +-- AND FolderData.Parent in ( +-- Select Parent FROM NonDupParent +-- ); \ No newline at end of file