fix(data-access): correct self-referential SQL in WorkCenter filter

The WHERE clause was comparing Code to itself instead of the aliased
table reference, which would always be true.
This commit is contained in:
Joseph Doherty
2026-01-06 14:12:07 -05:00
parent 34daf6a83b
commit d4135e8ad3
67 changed files with 8520 additions and 12 deletions
@@ -182,9 +182,9 @@ public sealed class SqlKataSearchQueryBuilder : ISearchQueryBuilder
--Insert from work centers directly
INSERT INTO #P_WorkCenters (Code)
SELECT Code
FROM dbo.fn_GetSearchWorkCenters(@SearchId)
WHERE NOT EXISTS (SELECT 1 FROM #P_WorkCenters WHERE Code = Code);
SELECT wc.Code
FROM dbo.fn_GetSearchWorkCenters(@SearchId) wc
WHERE NOT EXISTS (SELECT 1 FROM #P_WorkCenters pwc WHERE pwc.Code = wc.Code);
""";
}