Skip to content

Commit

Permalink
VCST-680: fix Association query (#723)
Browse files Browse the repository at this point in the history
  • Loading branch information
ksavosteev committed Mar 27, 2024
1 parent 17cd413 commit f1c60d5
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -299,11 +299,11 @@ FROM Association a"

command.Append(@"), Category_CTE AS
(
SELECT AssociatedCategoryId Id, AssociatedCategoryId
SELECT AssociatedCategoryId Id, AssociatedCategoryId, Id AssociationId
FROM Association_CTE
WHERE AssociatedCategoryId IS NOT NULL
UNION ALL
SELECT c.Id, cte.AssociatedCategoryId
SELECT c.Id, cte.AssociatedCategoryId, cte.AssociationId
FROM Category c
INNER JOIN Category_CTE cte ON c.ParentCategoryId = cte.Id
),
Expand All @@ -325,7 +325,7 @@ Item_CTE AS
,a.OuterId
FROM Category_CTE cat
LEFT JOIN Item i ON cat.Id=i.CategoryId
LEFT JOIN Association a ON cat.AssociatedCategoryId=a.AssociatedCategoryId
LEFT JOIN Association a ON cat.AssociationId = a.Id
WHERE i.ParentId IS NULL
UNION
SELECT * FROM Association_CTE
Expand Down

0 comments on commit f1c60d5

Please sign in to comment.