Created
October 24, 2024 12:58
-
-
Save spinningcat/b25d7b75292082ab0ab50d9bc998c989 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WITH CTE_SportAttributes AS ( | |
SELECT | |
st.*, | |
str."SportId" | |
FROM "dbo"."SportAttributes" AS st | |
INNER JOIN "dbo"."SportAttributesRelation" AS str | |
ON st."Id" = str."AttributeId" | |
), | |
CTE_SportAttributeGroups AS ( | |
SELECT | |
sag.*, | |
sagr."SportId" | |
FROM "dbo"."SportAttributeGroups" AS sag | |
INNER JOIN "dbo"."SportAttributeGroupsRelation" AS sagr | |
ON sag."Id" = sagr."AttributeGroupId" | |
) | |
SELECT * | |
FROM CTE_SportAttributes AS sa | |
INNER JOIN CTE_SportAttributeGroups AS sag | |
ON sa."SportId" = sag."SportId" | |
INNER JOIN "dbo"."Sports" as s | |
ON s."Id" = sa."SportId"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment