SHARE
TWEET

Untitled

a guest Feb 27th, 2020 76 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. SELECT *
  2. , IF(COUNT(pa.id) IS NULL, 0, COUNT(pa.id)) kol
  3. , SUM(IF(pa.pa_ga_id_search > 0 OR pa.pa_art_id = -2, 1, 0)) link
  4. , ROUND(IF(COUNT(pa.id) IS NULL, 0, SUM(IF(pa.pa_ga_id_search > 0 OR pa.pa_art_id = -2, 1, 0)) / COUNT(pa.id)), 2) link_proc
  5. FROM brand_all ba
  6. LEFT JOIN prices_all pa ON ba.id = pa.brand_id AND pa.avalaible_gen IN (0,1)
  7. WHERE ba.id IN (
  8. 27,
  9. 80,
  10. 149,
  11. 171,
  12. 192,
  13. 278,
  14. 331,
  15. 340,
  16. 408,
  17. 542,
  18. 580,
  19. 632,
  20. 653,
  21. 654,
  22. 758,
  23. 915,
  24. 954,
  25. 975,
  26. 1104,
  27. 1130,
  28. 1174,
  29. 1258,
  30. 1286,
  31. 1447,
  32. 1587,
  33. 1602,
  34. 1645,
  35. 1654,
  36. 1655,
  37. 1810,
  38. 1838,
  39. 1852,
  40. 1859,
  41. 1861,
  42. 1893,
  43. 1903,
  44. 1905,
  45. 1963,
  46. 1995,
  47. 2029,
  48. 2083,
  49. 2098,
  50. 2201,
  51. 2215,
  52. 2237,
  53. 2246,
  54. 2277,
  55. 2394,
  56. 2396,
  57. 2410,
  58. 2429,
  59. 2460,
  60. 2567,
  61. 2568,
  62. 2584,
  63. 2604,
  64. 2609,
  65. 2612,
  66. 2627,
  67. 2633,
  68. 2653,
  69. 2704,
  70. 2726,
  71. 2732,
  72. 2742,
  73. 2796,
  74. 2857,
  75. 2877,
  76. 2929,
  77. 3072,
  78. 3190,
  79. 10241,
  80. 10707,
  81. 11161,
  82. 11468,
  83. 11469,
  84. 11481,
  85. 11482,
  86. 11666,
  87. 12030,
  88. 12031,
  89. 12032,
  90. 12033,
  91. 12034,
  92. 12035,
  93. 12036
  94. )
  95.  
  96. AND (pa.pa_ga_id IS NULL OR pa.pa_ga_id IN (
  97. 938,
  98. 41313,
  99. 41314,
  100. 41315,
  101. 41316,
  102. 41317,
  103. 41318,
  104. 41319,
  105. 41352,
  106. 41382,
  107. 41383,
  108. 41399,
  109. 41411,
  110. 41426,
  111. 41435,
  112. 41439,
  113. 298,
  114. 62,
  115. 2504,
  116. 54293,
  117. 54294,
  118. 54295,
  119. 54296,
  120. 54297,
  121. 54298,
  122. 54299,
  123. 54300,
  124. 54397,
  125. 54400,
  126. 54406,
  127. 54416,
  128. 54425,
  129. 54427,
  130. 54428,
  131. 54430,
  132. 54434,
  133. 54436,
  134. 54460,
  135. 54461,
  136. 54462,
  137. 54476,
  138. 54484,
  139. 54491,
  140. 54492,
  141. 54493,
  142. 54507,
  143. 54515,
  144. 54522,
  145. 54523,
  146. 54530,
  147. 54537,
  148. 54540,
  149. 1488,
  150. 1914,
  151. 1915,
  152. 2809,
  153. 2810,
  154. 3392,
  155. 1377,
  156. 14,
  157. 1373,
  158. 1374,
  159. 1375,
  160. 712,
  161. 2872,
  162. 703,
  163. 2870,
  164. 289,
  165. 2484,
  166. 1560,
  167. 50130,
  168. 50132,
  169. 50133,
  170. 50134,
  171. 50135,
  172. 50136,
  173. 50137,
  174. 50138,
  175. 50139,
  176. 50140,
  177. 53977,
  178. 54041,
  179. 54073,
  180. 54089,
  181. 54104,
  182. 54160,
  183. 54191,
  184. 54206,
  185. 54213,
  186. 259,
  187. 3175,
  188. 3328,
  189. 30379,
  190. 30381,
  191. 30382,
  192. 30383,
  193. 30384,
  194. 30385,
  195. 30386,
  196. 30387,
  197. 30388,
  198. 30548,
  199. 30578,
  200. 30607,
  201. 30618,
  202. 30622,
  203. 30625,
  204. 794,
  205. 2903,
  206. 2801,
  207. 41699,
  208. 1191,
  209. 901,
  210. 4370,
  211. 449,
  212. 41247,
  213. 41248,
  214. 41249,
  215. 41250,
  216. 41251,
  217. 41252,
  218. 41283,
  219. 41284,
  220. 41292,
  221. 41299,
  222. 23,
  223. 2476,
  224. 3257,
  225. 3393,
  226. 531,
  227. 3331,
  228. 3232,
  229. 391,
  230. 2492,
  231. 291,
  232. 89,
  233. 3336,
  234. 88,
  235. 3335
  236. ))
  237. GROUP BY ba.id
  238. ORDER BY kol DESC
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top