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
from DuplicateList
)
AND Parent not in (
Select Parent
from NonDupParent
);
AND Parent NOT in (select B.Parent from NonDupParent as B)
order by Server
;

View File

@ -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';
FileCount, FileSize, Project as Source from FolderData
Where FolderData.Project in (
SELECT Project FROM NonDupProject)
-- AND FolderData.Parent in (
-- Select Parent FROM NonDupParent
-- );