Guest User

large sql

a guest
Jul 3rd, 2018
79
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. {SELECT
  2. `UnionAll1`.`Composer_Id` AS `C1`,
  3. `UnionAll1`.`C2`,
  4. `UnionAll1`.`Id` AS `C3`,
  5. `UnionAll1`.`DateAdded` AS `C4`,
  6. `UnionAll1`.`DateOfBirth` AS `C5`,
  7. `UnionAll1`.`DateOfDeath` AS `C6`,
  8. `UnionAll1`.`Order` AS `C7`,
  9. `UnionAll1`.`Profile_Id` AS `C8`,
  10. `UnionAll1`.`Id1` AS `C9`,
  11. `UnionAll1`.`C1` AS `C10`,
  12. `UnionAll1`.`Id2` AS `C11`,
  13. `UnionAll1`.`StorageId` AS `C12`,
  14. `UnionAll1`.`Composer_Id1` AS `C13`,
  15. `UnionAll1`.`Language` AS `C14`,
  16. `UnionAll1`.`CreatedUtc` AS `C15`,
  17. `UnionAll1`.`IsArchived` AS `C16`,
  18. `UnionAll1`.`C3` AS `C17`,
  19. `UnionAll1`.`C4` AS `C18`,
  20. `UnionAll1`.`C5` AS `C19`,
  21. `UnionAll1`.`C6` AS `C20`
  22. FROM ((SELECT
  23. CASE WHEN (`Join2`.`Id` IS  NULL) THEN (NULL)  ELSE (1) END AS `C1`,
  24. `Apply2`.`Composer_Id`,
  25. `Apply2`.`C1` AS `C2`,
  26. `Apply2`.`Id`,
  27. `Apply2`.`DateAdded`,
  28. `Apply2`.`DateOfBirth`,
  29. `Apply2`.`DateOfDeath`,
  30. `Apply2`.`Order`,
  31. `Apply2`.`Profile_Id`,
  32. `Apply2`.`Id1`,
  33. `Join2`.`Id` AS `Id2`,
  34. `Join2`.`StorageId`,
  35. `Join2`.`Composer_Id` AS `Composer_Id1`,
  36. `Join2`.`Language`,
  37. `Join2`.`CreatedUtc`,
  38. `Join2`.`IsArchived`,
  39. NULL AS `C3`,
  40. NULL AS `C4`,
  41. NULL AS `C5`,
  42. NULL AS `C6`
  43. FROM (SELECT
  44. `Project3`.`Composer_Id`,
  45. `Project3`.`Id`,
  46. `Project3`.`DateAdded`,
  47. `Project3`.`DateOfBirth`,
  48. `Project3`.`DateOfDeath`,
  49. `Project3`.`Order`,
  50. `Project3`.`Profile_Id`,
  51. `Project3`.`C1`,
  52. `Project3`.`Id1`
  53. FROM (SELECT
  54. `Apply1`.`Composer_Id`,
  55. `Extent3`.`Id`,
  56. `Extent3`.`DateAdded`,
  57. `Extent3`.`DateOfBirth`,
  58. `Extent3`.`DateOfDeath`,
  59. `Extent3`.`Order`,
  60. `Extent3`.`Profile_Id`,
  61. 1 AS `C1`,
  62. `Apply1`.`Id` AS `Id1`
  63. FROM (SELECT
  64. `Distinct1`.`Composer_Id`,
  65. (SELECT
  66. `Extent2`.`Id`
  67. FROM `ComposerName` AS `Extent2`
  68.  WHERE `Distinct1`.`Composer_Id` = `Extent2`.`Composer_Id` LIMIT 1) AS `Id`,
  69. (SELECT
  70. `Extent2`.`Composer_Id`
  71. FROM `ComposerName` AS `Extent2`
  72.  WHERE `Distinct1`.`Composer_Id` = `Extent2`.`Composer_Id` LIMIT 1) AS `COMPOSER_ID1`
  73. FROM (SELECT DISTINCT
  74. `Extent1`.`Composer_Id`
  75. FROM `ComposerName` AS `Extent1`) AS `Distinct1`) AS `Apply1` LEFT OUTER JOIN `Composer` AS `Extent3` ON `Apply1`.`COMPOSER_ID1` = `Extent3`.`Id`) AS `Project3`) AS `Apply2`) UNION ALL (SELECT
  76. 2 AS `C1`,
  77. `Apply4`.`Composer_Id`,
  78. `Apply4`.`C1` AS `C2`,
  79. `Apply4`.`Id1` AS `Id`,
  80. `Apply4`.`DateAdded`,
  81. `Apply4`.`DateOfBirth`,
  82. `Apply4`.`DateOfDeath`,
  83. `Apply4`.`Order`,
  84. `Apply4`.`Profile_Id`,
  85. `Apply4`.`Id` AS `Id1`,
  86. NULL AS `C3`,
  87. NULL AS `C4`,
  88. NULL AS `C5`,
  89. NULL AS `C6`,
  90. NULL AS `C7`,
  91. NULL AS `C8`,
  92. `Join4`.`Id` AS `Id2`,
  93. `Join4`.`Composer_Id` AS `Composer_Id1`,
  94. `Join4`.`Language`,
  95. `Join4`.`FullName`
  96. FROM (SELECT
  97. `Project8`.`Composer_Id`,
  98. `Project8`.`Id`,
  99. `Project8`.`Id1`,
  100. `Project8`.`DateAdded`,
  101. `Project8`.`DateOfBirth`,
  102. `Project8`.`DateOfDeath`,
  103. `Project8`.`Order`,
  104. `Project8`.`Profile_Id`,
  105. `Project8`.`C1`
  106. FROM (SELECT
  107. `Apply3`.`Composer_Id`,
  108. `Apply3`.`Id`,
  109. `Extent8`.`Id` AS `Id1`,
  110. `Extent8`.`DateAdded`,
  111. `Extent8`.`DateOfBirth`,
  112. `Extent8`.`DateOfDeath`,
  113. `Extent8`.`Order`,
  114. `Extent8`.`Profile_Id`,
  115. 1 AS `C1`
  116. FROM (SELECT
  117. `Distinct2`.`Composer_Id`,
  118. (SELECT
  119. `Extent7`.`Id`
  120. FROM `ComposerName` AS `Extent7`
  121.  WHERE `Distinct2`.`Composer_Id` = `Extent7`.`Composer_Id` LIMIT 1) AS `Id`,
  122. (SELECT
  123. `Extent7`.`Composer_Id`
  124. FROM `ComposerName` AS `Extent7`
  125.  WHERE `Distinct2`.`Composer_Id` = `Extent7`.`Composer_Id` LIMIT 1) AS `COMPOSER_ID1`
  126. FROM (SELECT DISTINCT
  127. `Extent6`.`Composer_Id`
  128. FROM `ComposerName` AS `Extent6`) AS `Distinct2`) AS `Apply3` LEFT OUTER JOIN `Composer` AS `Extent8` ON `Apply3`.`COMPOSER_ID1` = `Extent8`.`Id`) AS `Project8`) AS `Apply4`)) AS `UnionAll1`
  129.  ORDER BY
  130. `UnionAll1`.`Composer_Id` ASC,
  131. `UnionAll1`.`Id` ASC,
  132. `UnionAll1`.`Id1` ASC,
  133. `UnionAll1`.`C1` ASC}
RAW Paste Data