compare.sql 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. SELECT
  2. UNIX_TIMESTAMP(),
  3. p.str2, p.str0, p.rng0, p.rng2, p.rng3,
  4. p.dec2, p.str4, p.str3, p.rng4, p.rng5
  5. FROM (
  6. SELECT DISTINCT
  7. mx.account_name,
  8. mx.str0,
  9. mx.str1,
  10. mx.str2,
  11. mx.str3,
  12. mx.str4,
  13. mx.str5,
  14. mx.str6,
  15. mx.str7,
  16. mx.str8,
  17. mx.str9,
  18. mx.rng0,
  19. mx.rng1,
  20. mx.rng2,
  21. mx.rng3,
  22. mx.rng4,
  23. mx.rng5,
  24. mx.rng6,
  25. mx.rng7,
  26. mx.rng8,
  27. mx.rng9,
  28. mx.dec0,
  29. mx.dec1,
  30. mx.dec2,
  31. mx.dec3,
  32. mx.dec4,
  33. mx.dec5,
  34. mx.dec6,
  35. mx.dec7,
  36. mx.dec8,
  37. mx.dec9,
  38. mx.chk0_opt0,
  39. mx.chk0_opt1,
  40. mx.chk0_opt2,
  41. mx.chk0_opt3,
  42. mx.chk0_opt4,
  43. mx.chk1_opt0,
  44. mx.chk1_opt1,
  45. mx.chk1_opt2,
  46. mx.chk1_opt3,
  47. mx.chk1_opt4,
  48. mx.chk2_opt0,
  49. mx.chk2_opt1,
  50. mx.chk2_opt2,
  51. mx.chk2_opt3,
  52. mx.chk2_opt4,
  53. mx.chk3_opt0,
  54. mx.chk3_opt1,
  55. mx.chk3_opt2,
  56. mx.chk3_opt3,
  57. mx.chk3_opt4,
  58. mx.chk4_opt0,
  59. mx.chk4_opt1,
  60. mx.chk4_opt2,
  61. mx.chk4_opt3,
  62. mx.chk4_opt4,
  63. mx.chk5_opt0,
  64. mx.chk5_opt1,
  65. mx.chk5_opt2,
  66. mx.chk5_opt3,
  67. mx.chk5_opt4,
  68. mx.chk6_opt0,
  69. mx.chk6_opt1,
  70. mx.chk6_opt2,
  71. mx.chk6_opt3,
  72. mx.chk6_opt4,
  73. mx.chk7_opt0,
  74. mx.chk7_opt1,
  75. mx.chk7_opt2,
  76. mx.chk7_opt3,
  77. mx.chk7_opt4,
  78. mx.chk8_opt0,
  79. mx.chk8_opt1,
  80. mx.chk8_opt2,
  81. mx.chk8_opt3,
  82. mx.chk8_opt4,
  83. mx.chk9_opt0,
  84. mx.chk9_opt1,
  85. mx.chk9_opt2,
  86. mx.chk9_opt3,
  87. mx.chk9_opt4,
  88. mb.item_name,
  89. mb.str0 as _str0,
  90. mb.str1 as _str1,
  91. mb.str2 as _str2,
  92. mb.str3 as _str3,
  93. mb.str4 as _str4,
  94. mb.str5 as _str5,
  95. mb.str6 as _str6,
  96. mb.str7 as _str7,
  97. mb.str8 as _str8,
  98. mb.str9 as _str9,
  99. mb.rng0 as _rng0,
  100. mb.rng1 as _rng1,
  101. mb.rng2 as _rng2,
  102. mb.rng3 as _rng3,
  103. mb.rng4 as _rng4,
  104. mb.dec0 as _dec0,
  105. mb.dec1 as _dec1,
  106. mb.dec2 as _dec2,
  107. mb.dec3 as _dec3,
  108. mb.dec4 as _dec4,
  109. mb.chk0_opt0 as _chk0_opt0,
  110. mb.chk0_opt1 as _chk0_opt1,
  111. mb.chk0_opt2 as _chk0_opt2,
  112. mb.chk0_opt3 as _chk0_opt3,
  113. mb.chk0_opt4 as _chk0_opt4,
  114. mb.chk1_opt0 as _chk1_opt0,
  115. mb.chk1_opt1 as _chk1_opt1,
  116. mb.chk1_opt2 as _chk1_opt2,
  117. mb.chk1_opt3 as _chk1_opt3,
  118. mb.chk1_opt4 as _chk1_opt4,
  119. mb.chk2_opt0 as _chk2_opt0,
  120. mb.chk2_opt1 as _chk2_opt1,
  121. mb.chk2_opt2 as _chk2_opt2,
  122. mb.chk2_opt3 as _chk2_opt3,
  123. mb.chk2_opt4 as _chk2_opt4,
  124. mb.chk3_opt0 as _chk3_opt0,
  125. mb.chk3_opt1 as _chk3_opt1,
  126. mb.chk3_opt2 as _chk3_opt2,
  127. mb.chk3_opt3 as _chk3_opt3,
  128. mb.chk3_opt4 as _chk3_opt4,
  129. mb.chk4_opt0 as _chk4_opt0,
  130. mb.chk4_opt1 as _chk4_opt1,
  131. mb.chk4_opt2 as _chk4_opt2,
  132. mb.chk4_opt3 as _chk4_opt3,
  133. mb.chk4_opt4 as _chk4_opt4
  134. FROM
  135. crm_account as mx LEFT JOIN crm_account_item as mb ON mx.id = mb.account_id
  136. where true
  137. GROUP BY mx.buyer_id, mx.account_name
  138. having true and ( true or true or false ) and ( true or false ) and ( true or false ) and ( true or false )
  139. ) p
  140. having true
  141. having true and ( true or true or false ) and ( true or false ) and ( true or false ) and ( true or false )