Advertisement
Guest User

EF Core Query

a guest
May 11th, 2021
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 7.63 KB | None | 0 0
  1. SELECT "t0"."Id", "t0"."Name", "t1"."Id", "t1"."SetId", "t1"."TagId", "t1"."Id0", "t1"."SetId0", "t1"."ModelId", "t2"."Id", "t2"."VideoId", "t2"."TagId", "t2"."Id0", "t2"."VideoId0", "t2"."ModelId", "t3"."Id", "t3"."WallpaperId", "t3"."TagId", "t3"."Id0", "t3"."Id1", "t3"."SetId", "t3"."ModelId", "t4"."Id", "t4"."SetId", "t4"."TagId", "t4"."Id0", "t4"."SetId0", "t4"."ModelId", "t4"."Id1", "t5"."Id", "t5"."VideoId", "t5"."TagId", "t5"."Id0", "t5"."VideoId0", "t5"."ModelId", "t5"."Id1", "t6"."Id", "t6"."WallpaperId", "t6"."TagId", "t6"."Id0", "t6"."Id1", "t6"."SetId", "t6"."ModelId", "t6"."Id2", "t7"."Id", "t7"."SetId", "t7"."TagId", "t7"."Id0", "t7"."SetId0", "t7"."ModelId", "t7"."Id1", "t7"."Id2", "t8"."Id", "t8"."VideoId", "t8"."TagId", "t8"."Id0", "t8"."VideoId0", "t8"."ModelId", "t8"."Id1", "t8"."Id2", "t9"."Id", "t9"."WallpaperId", "t9"."TagId", "t9"."Id0", "t9"."Id1", "t9"."SetId", "t9"."ModelId", "t9"."Id2", "t9"."Id3", "t10"."Id", "t10"."SetId", "t10"."TagId", "t10"."Id0", "t11"."Id", "t11"."VideoId", "t11"."TagId", "t11"."Id0", "t12"."Id", "t12"."WallpaperId", "t12"."TagId", "t12"."Id0", "t12"."Id1"
  2. FROM (
  3.     SELECT "t"."Id", '' AS "Name"
  4.     FROM "Tags" AS "t"
  5.     WHERE "t"."Id" = 173
  6.     LIMIT 2
  7. ) AS "t0"
  8. LEFT JOIN (
  9.     SELECT "m"."Id", "s"."SetId", "s"."TagId", "s0"."Id" AS "Id0", "s1"."SetId" AS "SetId0", "s1"."ModelId"
  10.     FROM "SetTags" AS "s"
  11.     INNER JOIN "Sets" AS "s0" ON "s"."SetId" = "s0"."Id"
  12.     INNER JOIN "SetModels" AS "s1" ON "s0"."Id" = "s1"."SetId"
  13.     INNER JOIN "Models" AS "m" ON "s1"."ModelId" = "m"."Id"
  14. ) AS "t1" ON "t0"."Id" = "t1"."TagId"
  15. LEFT JOIN (
  16.     SELECT "m0"."Id", "v"."VideoId", "v"."TagId", "v0"."Id" AS "Id0", "v1"."VideoId" AS "VideoId0", "v1"."ModelId"
  17.     FROM "VideoTags" AS "v"
  18.     INNER JOIN "Videos" AS "v0" ON "v"."VideoId" = "v0"."Id"
  19.     INNER JOIN "VideoModels" AS "v1" ON "v0"."Id" = "v1"."VideoId"
  20.     INNER JOIN "Models" AS "m0" ON "v1"."ModelId" = "m0"."Id"
  21. ) AS "t2" ON "t0"."Id" = "t2"."TagId"
  22. LEFT JOIN (
  23.     SELECT "m1"."Id", "w"."WallpaperId", "w"."TagId", "w0"."Id" AS "Id0", "s2"."Id" AS "Id1", "s3"."SetId", "s3"."ModelId"
  24.     FROM "WallpaperTags" AS "w"
  25.     INNER JOIN "Wallpapers" AS "w0" ON "w"."WallpaperId" = "w0"."Id"
  26.     INNER JOIN "Sets" AS "s2" ON "w0"."SetId" = "s2"."Id"
  27.     INNER JOIN "SetModels" AS "s3" ON "s2"."Id" = "s3"."SetId"
  28.     INNER JOIN "Models" AS "m1" ON "s3"."ModelId" = "m1"."Id"
  29. ) AS "t3" ON "t0"."Id" = "t3"."TagId"
  30. LEFT JOIN (
  31.     SELECT "p"."Id", "s4"."SetId", "s4"."TagId", "s5"."Id" AS "Id0", "s6"."SetId" AS "SetId0", "s6"."ModelId", "m2"."Id" AS "Id1"
  32.     FROM "SetTags" AS "s4"
  33.     INNER JOIN "Sets" AS "s5" ON "s4"."SetId" = "s5"."Id"
  34.     INNER JOIN "SetModels" AS "s6" ON "s5"."Id" = "s6"."SetId"
  35.     INNER JOIN "Models" AS "m2" ON "s6"."ModelId" = "m2"."Id"
  36.     LEFT JOIN "Persons" AS "p" ON "m2"."PersonId" = "p"."Id"
  37. ) AS "t4" ON "t0"."Id" = "t4"."TagId"
  38. LEFT JOIN (
  39.     SELECT "p0"."Id", "v2"."VideoId", "v2"."TagId", "v3"."Id" AS "Id0", "v4"."VideoId" AS "VideoId0", "v4"."ModelId", "m3"."Id" AS "Id1"
  40.     FROM "VideoTags" AS "v2"
  41.     INNER JOIN "Videos" AS "v3" ON "v2"."VideoId" = "v3"."Id"
  42.     INNER JOIN "VideoModels" AS "v4" ON "v3"."Id" = "v4"."VideoId"
  43.     INNER JOIN "Models" AS "m3" ON "v4"."ModelId" = "m3"."Id"
  44.     LEFT JOIN "Persons" AS "p0" ON "m3"."PersonId" = "p0"."Id"
  45. ) AS "t5" ON "t0"."Id" = "t5"."TagId"
  46. LEFT JOIN (
  47.     SELECT "p1"."Id", "w1"."WallpaperId", "w1"."TagId", "w2"."Id" AS "Id0", "s7"."Id" AS "Id1", "s8"."SetId", "s8"."ModelId", "m4"."Id" AS "Id2"
  48.     FROM "WallpaperTags" AS "w1"
  49.     INNER JOIN "Wallpapers" AS "w2" ON "w1"."WallpaperId" = "w2"."Id"
  50.     INNER JOIN "Sets" AS "s7" ON "w2"."SetId" = "s7"."Id"
  51.     INNER JOIN "SetModels" AS "s8" ON "s7"."Id" = "s8"."SetId"
  52.     INNER JOIN "Models" AS "m4" ON "s8"."ModelId" = "m4"."Id"
  53.     LEFT JOIN "Persons" AS "p1" ON "m4"."PersonId" = "p1"."Id"
  54. ) AS "t6" ON "t0"."Id" = "t6"."TagId"
  55. LEFT JOIN (
  56.     SELECT "c"."Id", "s9"."SetId", "s9"."TagId", "s10"."Id" AS "Id0", "s11"."SetId" AS "SetId0", "s11"."ModelId", "m5"."Id" AS "Id1", "p2"."Id" AS "Id2"
  57.     FROM "SetTags" AS "s9"
  58.     INNER JOIN "Sets" AS "s10" ON "s9"."SetId" = "s10"."Id"
  59.     INNER JOIN "SetModels" AS "s11" ON "s10"."Id" = "s11"."SetId"
  60.     INNER JOIN "Models" AS "m5" ON "s11"."ModelId" = "m5"."Id"
  61.     LEFT JOIN "Persons" AS "p2" ON "m5"."PersonId" = "p2"."Id"
  62.     LEFT JOIN "Countries" AS "c" ON "p2"."CountryId" = "c"."Id"
  63. ) AS "t7" ON "t0"."Id" = "t7"."TagId"
  64. LEFT JOIN (
  65.     SELECT "c0"."Id", "v5"."VideoId", "v5"."TagId", "v6"."Id" AS "Id0", "v7"."VideoId" AS "VideoId0", "v7"."ModelId", "m6"."Id" AS "Id1", "p3"."Id" AS "Id2"
  66.     FROM "VideoTags" AS "v5"
  67.     INNER JOIN "Videos" AS "v6" ON "v5"."VideoId" = "v6"."Id"
  68.     INNER JOIN "VideoModels" AS "v7" ON "v6"."Id" = "v7"."VideoId"
  69.     INNER JOIN "Models" AS "m6" ON "v7"."ModelId" = "m6"."Id"
  70.     LEFT JOIN "Persons" AS "p3" ON "m6"."PersonId" = "p3"."Id"
  71.     LEFT JOIN "Countries" AS "c0" ON "p3"."CountryId" = "c0"."Id"
  72. ) AS "t8" ON "t0"."Id" = "t8"."TagId"
  73. LEFT JOIN (
  74.     SELECT "c1"."Id", "w3"."WallpaperId", "w3"."TagId", "w4"."Id" AS "Id0", "s12"."Id" AS "Id1", "s13"."SetId", "s13"."ModelId", "m7"."Id" AS "Id2", "p4"."Id" AS "Id3"
  75.     FROM "WallpaperTags" AS "w3"
  76.     INNER JOIN "Wallpapers" AS "w4" ON "w3"."WallpaperId" = "w4"."Id"
  77.     INNER JOIN "Sets" AS "s12" ON "w4"."SetId" = "s12"."Id"
  78.     INNER JOIN "SetModels" AS "s13" ON "s12"."Id" = "s13"."SetId"
  79.     INNER JOIN "Models" AS "m7" ON "s13"."ModelId" = "m7"."Id"
  80.     LEFT JOIN "Persons" AS "p4" ON "m7"."PersonId" = "p4"."Id"
  81.     LEFT JOIN "Countries" AS "c1" ON "p4"."CountryId" = "c1"."Id"
  82. ) AS "t9" ON "t0"."Id" = "t9"."TagId"
  83. LEFT JOIN (
  84.     SELECT "p5"."Id", "s14"."SetId", "s14"."TagId", "s15"."Id" AS "Id0"
  85.     FROM "SetTags" AS "s14"
  86.     INNER JOIN "Sets" AS "s15" ON "s14"."SetId" = "s15"."Id"
  87.     INNER JOIN "Publishers" AS "p5" ON "s15"."PublisherId" = "p5"."Id"
  88. ) AS "t10" ON "t0"."Id" = "t10"."TagId"
  89. LEFT JOIN (
  90.     SELECT "p6"."Id", "v8"."VideoId", "v8"."TagId", "v9"."Id" AS "Id0"
  91.     FROM "VideoTags" AS "v8"
  92.     INNER JOIN "Videos" AS "v9" ON "v8"."VideoId" = "v9"."Id"
  93.     INNER JOIN "Publishers" AS "p6" ON "v9"."PublisherId" = "p6"."Id"
  94. ) AS "t11" ON "t0"."Id" = "t11"."TagId"
  95. LEFT JOIN (
  96.     SELECT "p7"."Id", "w5"."WallpaperId", "w5"."TagId", "w6"."Id" AS "Id0", "s16"."Id" AS "Id1"
  97.     FROM "WallpaperTags" AS "w5"
  98.     INNER JOIN "Wallpapers" AS "w6" ON "w5"."WallpaperId" = "w6"."Id"
  99.     INNER JOIN "Sets" AS "s16" ON "w6"."SetId" = "s16"."Id"
  100.     INNER JOIN "Publishers" AS "p7" ON "s16"."PublisherId" = "p7"."Id"
  101. ) AS "t12" ON "t0"."Id" = "t12"."TagId"
  102. ORDER BY "t0"."Id", "t1"."SetId", "t1"."TagId", "t1"."Id0", "t1"."SetId0", "t1"."ModelId", "t1"."Id", "t2"."VideoId", "t2"."TagId", "t2"."Id0", "t2"."VideoId0", "t2"."ModelId", "t2"."Id", "t3"."WallpaperId", "t3"."TagId", "t3"."Id0", "t3"."Id1", "t3"."SetId", "t3"."ModelId", "t3"."Id", "t4"."SetId", "t4"."TagId", "t4"."Id0", "t4"."SetId0", "t4"."ModelId", "t4"."Id1", "t4"."Id", "t5"."VideoId", "t5"."TagId", "t5"."Id0", "t5"."VideoId0", "t5"."ModelId", "t5"."Id1", "t5"."Id", "t6"."WallpaperId", "t6"."TagId", "t6"."Id0", "t6"."Id1", "t6"."SetId", "t6"."ModelId", "t6"."Id2", "t6"."Id", "t7"."SetId", "t7"."TagId", "t7"."Id0", "t7"."SetId0", "t7"."ModelId", "t7"."Id1", "t7"."Id2", "t7"."Id", "t8"."VideoId", "t8"."TagId", "t8"."Id0", "t8"."VideoId0", "t8"."ModelId", "t8"."Id1", "t8"."Id2", "t8"."Id", "t9"."WallpaperId", "t9"."TagId", "t9"."Id0", "t9"."Id1", "t9"."SetId", "t9"."ModelId", "t9"."Id2", "t9"."Id3", "t9"."Id", "t10"."SetId", "t10"."TagId", "t10"."Id0", "t10"."Id", "t11"."VideoId", "t11"."TagId", "t11"."Id0", "t11"."Id", "t12"."WallpaperId", "t12"."TagId", "t12"."Id0", "t12"."Id1", "t12"."Id"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement