Skip to content

Instantly share code, notes, and snippets.

@DmitrySikorsky
Created July 13, 2019 09:14
Show Gist options
  • Save DmitrySikorsky/cdd371fe753d936da7eab67e4aa728ef to your computer and use it in GitHub Desktop.
Save DmitrySikorsky/cdd371fe753d936da7eab67e4aa728ef to your computer and use it in GitHub Desktop.
SELECT "b"."Id", (
SELECT "l"."Value"
FROM "Localizations" AS "l"
WHERE ("l"."CultureCode" = 'en') AND ("b.Name"."Id" = "l"."LocalizationSetId")
LIMIT 1
) AS "Name", (
SELECT "l0"."Value"
FROM "Localizations" AS "l0"
WHERE ("l0"."CultureCode" = 'en') AND ("b.Description"."Id" = "l0"."LocalizationSetId")
LIMIT 1
) AS "Description", (
SELECT "l1"."Value"
FROM "Localizations" AS "l1"
WHERE ("l1"."CultureCode" = 'en') AND ("b.Author"."Id" = "l1"."LocalizationSetId")
LIMIT 1
) AS "Author", "b"."Year"
FROM "Books" AS "b"
INNER JOIN "LocalizationSets" AS "b.Author" ON "b"."AuthorId" = "b.Author"."Id"
INNER JOIN "LocalizationSets" AS "b.Description" ON "b"."DescriptionId" = "b.Description"."Id"
INNER JOIN "LocalizationSets" AS "b.Name" ON "b"."NameId" = "b.Name"."Id"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment