Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Sep 22nd, 2012  |  syntax: SQL  |  size: 68.63 KB  |  views: 14  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  2. deals_locations.location_ID, deals.hits
  3. FROM deals
  4. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  5. AND deals_locations.location_ID = '1'
  6. WHERE deals.STATUS = 'active'
  7. AND deals_locations.deal_ID = deals.deal_ID
  8. GROUP BY deals.deal_ID
  9. LIMIT 5)
  10. UNION ALL
  11. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  12. deals_locations.location_ID, deals.hits
  13. FROM deals
  14. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  15. AND deals_locations.location_ID = '2'
  16. WHERE deals.STATUS = 'active'
  17. AND deals_locations.deal_ID = deals.deal_ID
  18. GROUP BY deals.deal_ID
  19. LIMIT 5)
  20. UNION ALL
  21. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  22. deals_locations.location_ID, deals.hits
  23. FROM deals
  24. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  25. AND deals_locations.location_ID = '3'
  26. WHERE deals.STATUS = 'active'
  27. AND deals_locations.deal_ID = deals.deal_ID
  28. GROUP BY deals.deal_ID
  29. LIMIT 5)
  30. UNION ALL
  31. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  32. deals_locations.location_ID, deals.hits
  33. FROM deals
  34. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  35. AND deals_locations.location_ID = '5'
  36. WHERE deals.STATUS = 'active'
  37. AND deals_locations.deal_ID = deals.deal_ID
  38. GROUP BY deals.deal_ID
  39. LIMIT 5)
  40. UNION ALL
  41. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  42. deals_locations.location_ID, deals.hits
  43. FROM deals
  44. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  45. AND deals_locations.location_ID = '7'
  46. WHERE deals.STATUS = 'active'
  47. AND deals_locations.deal_ID = deals.deal_ID
  48. GROUP BY deals.deal_ID
  49. LIMIT 5)
  50. UNION ALL
  51. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  52. deals_locations.location_ID, deals.hits
  53. FROM deals
  54. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  55. AND deals_locations.location_ID = '12'
  56. WHERE deals.STATUS = 'active'
  57. AND deals_locations.deal_ID = deals.deal_ID
  58. GROUP BY deals.deal_ID
  59. LIMIT 5)
  60. UNION ALL
  61. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  62. deals_locations.location_ID, deals.hits
  63. FROM deals
  64. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  65. AND deals_locations.location_ID = '13'
  66. WHERE deals.STATUS = 'active'
  67. AND deals_locations.deal_ID = deals.deal_ID
  68. GROUP BY deals.deal_ID
  69. LIMIT 5)
  70. UNION ALL
  71. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  72. deals_locations.location_ID, deals.hits
  73. FROM deals
  74. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  75. AND deals_locations.location_ID = '26'
  76. WHERE deals.STATUS = 'active'
  77. AND deals_locations.deal_ID = deals.deal_ID
  78. GROUP BY deals.deal_ID
  79. LIMIT 5)
  80. UNION ALL
  81. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  82. deals_locations.location_ID, deals.hits
  83. FROM deals
  84. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  85. AND deals_locations.location_ID = '27'
  86. WHERE deals.STATUS = 'active'
  87. AND deals_locations.deal_ID = deals.deal_ID
  88. GROUP BY deals.deal_ID
  89. LIMIT 5)
  90. UNION ALL
  91. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  92. deals_locations.location_ID, deals.hits
  93. FROM deals
  94. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  95. AND deals_locations.location_ID = '28'
  96. WHERE deals.STATUS = 'active'
  97. AND deals_locations.deal_ID = deals.deal_ID
  98. GROUP BY deals.deal_ID
  99. LIMIT 5)
  100. UNION ALL
  101. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  102. deals_locations.location_ID, deals.hits
  103. FROM deals
  104. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  105. AND deals_locations.location_ID = '29'
  106. WHERE deals.STATUS = 'active'
  107. AND deals_locations.deal_ID = deals.deal_ID
  108. GROUP BY deals.deal_ID
  109. LIMIT 5)
  110. UNION ALL
  111. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  112. deals_locations.location_ID, deals.hits
  113. FROM deals
  114. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  115. AND deals_locations.location_ID = '30'
  116. WHERE deals.STATUS = 'active'
  117. AND deals_locations.deal_ID = deals.deal_ID
  118. GROUP BY deals.deal_ID
  119. LIMIT 5)
  120. UNION ALL
  121. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  122. deals_locations.location_ID, deals.hits
  123. FROM deals
  124. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  125. AND deals_locations.location_ID = '31'
  126. WHERE deals.STATUS = 'active'
  127. AND deals_locations.deal_ID = deals.deal_ID
  128. GROUP BY deals.deal_ID
  129. LIMIT 5)
  130. UNION ALL
  131. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  132. deals_locations.location_ID, deals.hits
  133. FROM deals
  134. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  135. AND deals_locations.location_ID = '34'
  136. WHERE deals.STATUS = 'active'
  137. AND deals_locations.deal_ID = deals.deal_ID
  138. GROUP BY deals.deal_ID
  139. LIMIT 5)
  140. UNION ALL
  141. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  142. deals_locations.location_ID, deals.hits
  143. FROM deals
  144. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  145. AND deals_locations.location_ID = '35'
  146. WHERE deals.STATUS = 'active'
  147. AND deals_locations.deal_ID = deals.deal_ID
  148. GROUP BY deals.deal_ID
  149. LIMIT 5)
  150. UNION ALL
  151. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  152. deals_locations.location_ID, deals.hits
  153. FROM deals
  154. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  155. AND deals_locations.location_ID = '36'
  156. WHERE deals.STATUS = 'active'
  157. AND deals_locations.deal_ID = deals.deal_ID
  158. GROUP BY deals.deal_ID
  159. LIMIT 5)
  160. UNION ALL
  161. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  162. deals_locations.location_ID, deals.hits
  163. FROM deals
  164. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  165. AND deals_locations.location_ID = '38'
  166. WHERE deals.STATUS = 'active'
  167. AND deals_locations.deal_ID = deals.deal_ID
  168. GROUP BY deals.deal_ID
  169. LIMIT 5)
  170. UNION ALL
  171. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  172. deals_locations.location_ID, deals.hits
  173. FROM deals
  174. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  175. AND deals_locations.location_ID = '39'
  176. WHERE deals.STATUS = 'active'
  177. AND deals_locations.deal_ID = deals.deal_ID
  178. GROUP BY deals.deal_ID
  179. LIMIT 5)
  180. UNION ALL
  181. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  182. deals_locations.location_ID, deals.hits
  183. FROM deals
  184. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  185. AND deals_locations.location_ID = '40'
  186. WHERE deals.STATUS = 'active'
  187. AND deals_locations.deal_ID = deals.deal_ID
  188. GROUP BY deals.deal_ID
  189. LIMIT 5)
  190. UNION ALL
  191. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  192. deals_locations.location_ID, deals.hits
  193. FROM deals
  194. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  195. AND deals_locations.location_ID = '41'
  196. WHERE deals.STATUS = 'active'
  197. AND deals_locations.deal_ID = deals.deal_ID
  198. GROUP BY deals.deal_ID
  199. LIMIT 5)
  200. UNION ALL
  201. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  202. deals_locations.location_ID, deals.hits
  203. FROM deals
  204. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  205. AND deals_locations.location_ID = '42'
  206. WHERE deals.STATUS = 'active'
  207. AND deals_locations.deal_ID = deals.deal_ID
  208. GROUP BY deals.deal_ID
  209. LIMIT 5)
  210. UNION ALL
  211. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  212. deals_locations.location_ID, deals.hits
  213. FROM deals
  214. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  215. AND deals_locations.location_ID = '43'
  216. WHERE deals.STATUS = 'active'
  217. AND deals_locations.deal_ID = deals.deal_ID
  218. GROUP BY deals.deal_ID
  219. LIMIT 5)
  220. UNION ALL
  221. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  222. deals_locations.location_ID, deals.hits
  223. FROM deals
  224. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  225. AND deals_locations.location_ID = '44'
  226. WHERE deals.STATUS = 'active'
  227. AND deals_locations.deal_ID = deals.deal_ID
  228. GROUP BY deals.deal_ID
  229. LIMIT 5)
  230. UNION ALL
  231. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  232. deals_locations.location_ID, deals.hits
  233. FROM deals
  234. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  235. AND deals_locations.location_ID = '46'
  236. WHERE deals.STATUS = 'active'
  237. AND deals_locations.deal_ID = deals.deal_ID
  238. GROUP BY deals.deal_ID
  239. LIMIT 5)
  240. UNION ALL
  241. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  242. deals_locations.location_ID, deals.hits
  243. FROM deals
  244. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  245. AND deals_locations.location_ID = '49'
  246. WHERE deals.STATUS = 'active'
  247. AND deals_locations.deal_ID = deals.deal_ID
  248. GROUP BY deals.deal_ID
  249. LIMIT 5)
  250. UNION ALL
  251. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  252. deals_locations.location_ID, deals.hits
  253. FROM deals
  254. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  255. AND deals_locations.location_ID = '52'
  256. WHERE deals.STATUS = 'active'
  257. AND deals_locations.deal_ID = deals.deal_ID
  258. GROUP BY deals.deal_ID
  259. LIMIT 5)
  260. UNION ALL
  261. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  262. deals_locations.location_ID, deals.hits
  263. FROM deals
  264. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  265. AND deals_locations.location_ID = '53'
  266. WHERE deals.STATUS = 'active'
  267. AND deals_locations.deal_ID = deals.deal_ID
  268. GROUP BY deals.deal_ID
  269. LIMIT 5)
  270. UNION ALL
  271. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  272. deals_locations.location_ID, deals.hits
  273. FROM deals
  274. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  275. AND deals_locations.location_ID = '54'
  276. WHERE deals.STATUS = 'active'
  277. AND deals_locations.deal_ID = deals.deal_ID
  278. GROUP BY deals.deal_ID
  279. LIMIT 5)
  280. UNION ALL
  281. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  282. deals_locations.location_ID, deals.hits
  283. FROM deals
  284. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  285. AND deals_locations.location_ID = '55'
  286. WHERE deals.STATUS = 'active'
  287. AND deals_locations.deal_ID = deals.deal_ID
  288. GROUP BY deals.deal_ID
  289. LIMIT 5)
  290. UNION ALL
  291. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  292. deals_locations.location_ID, deals.hits
  293. FROM deals
  294. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  295. AND deals_locations.location_ID = '56'
  296. WHERE deals.STATUS = 'active'
  297. AND deals_locations.deal_ID = deals.deal_ID
  298. GROUP BY deals.deal_ID
  299. LIMIT 5)
  300. UNION ALL
  301. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  302. deals_locations.location_ID, deals.hits
  303. FROM deals
  304. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  305. AND deals_locations.location_ID = '60'
  306. WHERE deals.STATUS = 'active'
  307. AND deals_locations.deal_ID = deals.deal_ID
  308. GROUP BY deals.deal_ID
  309. LIMIT 5)
  310. UNION ALL
  311. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  312. deals_locations.location_ID, deals.hits
  313. FROM deals
  314. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  315. AND deals_locations.location_ID = '62'
  316. WHERE deals.STATUS = 'active'
  317. AND deals_locations.deal_ID = deals.deal_ID
  318. GROUP BY deals.deal_ID
  319. LIMIT 5)
  320. UNION ALL
  321. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  322. deals_locations.location_ID, deals.hits
  323. FROM deals
  324. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  325. AND deals_locations.location_ID = '64'
  326. WHERE deals.STATUS = 'active'
  327. AND deals_locations.deal_ID = deals.deal_ID
  328. GROUP BY deals.deal_ID
  329. LIMIT 5)
  330. UNION ALL
  331. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  332. deals_locations.location_ID, deals.hits
  333. FROM deals
  334. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  335. AND deals_locations.location_ID = '65'
  336. WHERE deals.STATUS = 'active'
  337. AND deals_locations.deal_ID = deals.deal_ID
  338. GROUP BY deals.deal_ID
  339. LIMIT 5)
  340. UNION ALL
  341. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  342. deals_locations.location_ID, deals.hits
  343. FROM deals
  344. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  345. AND deals_locations.location_ID = '66'
  346. WHERE deals.STATUS = 'active'
  347. AND deals_locations.deal_ID = deals.deal_ID
  348. GROUP BY deals.deal_ID
  349. LIMIT 5)
  350. UNION ALL
  351. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  352. deals_locations.location_ID, deals.hits
  353. FROM deals
  354. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  355. AND deals_locations.location_ID = '67'
  356. WHERE deals.STATUS = 'active'
  357. AND deals_locations.deal_ID = deals.deal_ID
  358. GROUP BY deals.deal_ID
  359. LIMIT 5)
  360. UNION ALL
  361. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  362. deals_locations.location_ID, deals.hits
  363. FROM deals
  364. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  365. AND deals_locations.location_ID = '68'
  366. WHERE deals.STATUS = 'active'
  367. AND deals_locations.deal_ID = deals.deal_ID
  368. GROUP BY deals.deal_ID
  369. LIMIT 5)
  370. UNION ALL
  371. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  372. deals_locations.location_ID, deals.hits
  373. FROM deals
  374. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  375. AND deals_locations.location_ID = '69'
  376. WHERE deals.STATUS = 'active'
  377. AND deals_locations.deal_ID = deals.deal_ID
  378. GROUP BY deals.deal_ID
  379. LIMIT 5)
  380. UNION ALL
  381. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  382. deals_locations.location_ID, deals.hits
  383. FROM deals
  384. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  385. AND deals_locations.location_ID = '70'
  386. WHERE deals.STATUS = 'active'
  387. AND deals_locations.deal_ID = deals.deal_ID
  388. GROUP BY deals.deal_ID
  389. LIMIT 5)
  390. UNION ALL
  391. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  392. deals_locations.location_ID, deals.hits
  393. FROM deals
  394. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  395. AND deals_locations.location_ID = '72'
  396. WHERE deals.STATUS = 'active'
  397. AND deals_locations.deal_ID = deals.deal_ID
  398. GROUP BY deals.deal_ID
  399. LIMIT 5)
  400. UNION ALL
  401. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  402. deals_locations.location_ID, deals.hits
  403. FROM deals
  404. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  405. AND deals_locations.location_ID = '74'
  406. WHERE deals.STATUS = 'active'
  407. AND deals_locations.deal_ID = deals.deal_ID
  408. GROUP BY deals.deal_ID
  409. LIMIT 5)
  410. UNION ALL
  411. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  412. deals_locations.location_ID, deals.hits
  413. FROM deals
  414. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  415. AND deals_locations.location_ID = '75'
  416. WHERE deals.STATUS = 'active'
  417. AND deals_locations.deal_ID = deals.deal_ID
  418. GROUP BY deals.deal_ID
  419. LIMIT 5)
  420. UNION ALL
  421. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  422. deals_locations.location_ID, deals.hits
  423. FROM deals
  424. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  425. AND deals_locations.location_ID = '76'
  426. WHERE deals.STATUS = 'active'
  427. AND deals_locations.deal_ID = deals.deal_ID
  428. GROUP BY deals.deal_ID
  429. LIMIT 5)
  430. UNION ALL
  431. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  432. deals_locations.location_ID, deals.hits
  433. FROM deals
  434. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  435. AND deals_locations.location_ID = '77'
  436. WHERE deals.STATUS = 'active'
  437. AND deals_locations.deal_ID = deals.deal_ID
  438. GROUP BY deals.deal_ID
  439. LIMIT 5)
  440. UNION ALL
  441. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  442. deals_locations.location_ID, deals.hits
  443. FROM deals
  444. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  445. AND deals_locations.location_ID = '78'
  446. WHERE deals.STATUS = 'active'
  447. AND deals_locations.deal_ID = deals.deal_ID
  448. GROUP BY deals.deal_ID
  449. LIMIT 5)
  450. UNION ALL
  451. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  452. deals_locations.location_ID, deals.hits
  453. FROM deals
  454. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  455. AND deals_locations.location_ID = '79'
  456. WHERE deals.STATUS = 'active'
  457. AND deals_locations.deal_ID = deals.deal_ID
  458. GROUP BY deals.deal_ID
  459. LIMIT 5)
  460. UNION ALL
  461. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  462. deals_locations.location_ID, deals.hits
  463. FROM deals
  464. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  465. AND deals_locations.location_ID = '80'
  466. WHERE deals.STATUS = 'active'
  467. AND deals_locations.deal_ID = deals.deal_ID
  468. GROUP BY deals.deal_ID
  469. LIMIT 5)
  470. UNION ALL
  471. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  472. deals_locations.location_ID, deals.hits
  473. FROM deals
  474. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  475. AND deals_locations.location_ID = '81'
  476. WHERE deals.STATUS = 'active'
  477. AND deals_locations.deal_ID = deals.deal_ID
  478. GROUP BY deals.deal_ID
  479. LIMIT 5)
  480. UNION ALL
  481. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  482. deals_locations.location_ID, deals.hits
  483. FROM deals
  484. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  485. AND deals_locations.location_ID = '82'
  486. WHERE deals.STATUS = 'active'
  487. AND deals_locations.deal_ID = deals.deal_ID
  488. GROUP BY deals.deal_ID
  489. LIMIT 5)
  490. UNION ALL
  491. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  492. deals_locations.location_ID, deals.hits
  493. FROM deals
  494. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  495. AND deals_locations.location_ID = '83'
  496. WHERE deals.STATUS = 'active'
  497. AND deals_locations.deal_ID = deals.deal_ID
  498. GROUP BY deals.deal_ID
  499. LIMIT 5)
  500. UNION ALL
  501. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  502. deals_locations.location_ID, deals.hits
  503. FROM deals
  504. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  505. AND deals_locations.location_ID = '89'
  506. WHERE deals.STATUS = 'active'
  507. AND deals_locations.deal_ID = deals.deal_ID
  508. GROUP BY deals.deal_ID
  509. LIMIT 5)
  510. UNION ALL
  511. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  512. deals_locations.location_ID, deals.hits
  513. FROM deals
  514. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  515. AND deals_locations.location_ID = '90'
  516. WHERE deals.STATUS = 'active'
  517. AND deals_locations.deal_ID = deals.deal_ID
  518. GROUP BY deals.deal_ID
  519. LIMIT 5)
  520. UNION ALL
  521. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  522. deals_locations.location_ID, deals.hits
  523. FROM deals
  524. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  525. AND deals_locations.location_ID = '97'
  526. WHERE deals.STATUS = 'active'
  527. AND deals_locations.deal_ID = deals.deal_ID
  528. GROUP BY deals.deal_ID
  529. LIMIT 5)
  530. UNION ALL
  531. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  532. deals_locations.location_ID, deals.hits
  533. FROM deals
  534. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  535. AND deals_locations.location_ID = '107'
  536. WHERE deals.STATUS = 'active'
  537. AND deals_locations.deal_ID = deals.deal_ID
  538. GROUP BY deals.deal_ID
  539. LIMIT 5)
  540. UNION ALL
  541. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  542. deals_locations.location_ID, deals.hits
  543. FROM deals
  544. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  545. AND deals_locations.location_ID = '10'
  546. WHERE deals.STATUS = 'active'
  547. AND deals_locations.deal_ID = deals.deal_ID
  548. GROUP BY deals.deal_ID
  549. LIMIT 5)
  550. UNION ALL
  551. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  552. deals_locations.location_ID, deals.hits
  553. FROM deals
  554. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  555. AND deals_locations.location_ID = '21'
  556. WHERE deals.STATUS = 'active'
  557. AND deals_locations.deal_ID = deals.deal_ID
  558. GROUP BY deals.deal_ID
  559. LIMIT 5)
  560. UNION ALL
  561. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  562. deals_locations.location_ID, deals.hits
  563. FROM deals
  564. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  565. AND deals_locations.location_ID = '32'
  566. WHERE deals.STATUS = 'active'
  567. AND deals_locations.deal_ID = deals.deal_ID
  568. GROUP BY deals.deal_ID
  569. LIMIT 5)
  570. UNION ALL
  571. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  572. deals_locations.location_ID, deals.hits
  573. FROM deals
  574. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  575. AND deals_locations.location_ID = '33'
  576. WHERE deals.STATUS = 'active'
  577. AND deals_locations.deal_ID = deals.deal_ID
  578. GROUP BY deals.deal_ID
  579. LIMIT 5)
  580. UNION ALL
  581. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  582. deals_locations.location_ID, deals.hits
  583. FROM deals
  584. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  585. AND deals_locations.location_ID = '37'
  586. WHERE deals.STATUS = 'active'
  587. AND deals_locations.deal_ID = deals.deal_ID
  588. GROUP BY deals.deal_ID
  589. LIMIT 5)
  590. UNION ALL
  591. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  592. deals_locations.location_ID, deals.hits
  593. FROM deals
  594. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  595. AND deals_locations.location_ID = '51'
  596. WHERE deals.STATUS = 'active'
  597. AND deals_locations.deal_ID = deals.deal_ID
  598. GROUP BY deals.deal_ID
  599. LIMIT 5)
  600. UNION ALL
  601. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  602. deals_locations.location_ID, deals.hits
  603. FROM deals
  604. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  605. AND deals_locations.location_ID = '4'
  606. WHERE deals.STATUS = 'active'
  607. AND deals_locations.deal_ID = deals.deal_ID
  608. GROUP BY deals.deal_ID
  609. LIMIT 5)
  610. UNION ALL
  611. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  612. deals_locations.location_ID, deals.hits
  613. FROM deals
  614. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  615. AND deals_locations.location_ID = '6'
  616. WHERE deals.STATUS = 'active'
  617. AND deals_locations.deal_ID = deals.deal_ID
  618. GROUP BY deals.deal_ID
  619. LIMIT 5)
  620. UNION ALL
  621. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  622. deals_locations.location_ID, deals.hits
  623. FROM deals
  624. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  625. AND deals_locations.location_ID = '8'
  626. WHERE deals.STATUS = 'active'
  627. AND deals_locations.deal_ID = deals.deal_ID
  628. GROUP BY deals.deal_ID
  629. LIMIT 5)
  630. UNION ALL
  631. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  632. deals_locations.location_ID, deals.hits
  633. FROM deals
  634. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  635. AND deals_locations.location_ID = '9'
  636. WHERE deals.STATUS = 'active'
  637. AND deals_locations.deal_ID = deals.deal_ID
  638. GROUP BY deals.deal_ID
  639. LIMIT 5)
  640. UNION ALL
  641. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  642. deals_locations.location_ID, deals.hits
  643. FROM deals
  644. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  645. AND deals_locations.location_ID = '11'
  646. WHERE deals.STATUS = 'active'
  647. AND deals_locations.deal_ID = deals.deal_ID
  648. GROUP BY deals.deal_ID
  649. LIMIT 5)
  650. UNION ALL
  651. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  652. deals_locations.location_ID, deals.hits
  653. FROM deals
  654. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  655. AND deals_locations.location_ID = '14'
  656. WHERE deals.STATUS = 'active'
  657. AND deals_locations.deal_ID = deals.deal_ID
  658. GROUP BY deals.deal_ID
  659. LIMIT 5)
  660. UNION ALL
  661. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  662. deals_locations.location_ID, deals.hits
  663. FROM deals
  664. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  665. AND deals_locations.location_ID = '15'
  666. WHERE deals.STATUS = 'active'
  667. AND deals_locations.deal_ID = deals.deal_ID
  668. GROUP BY deals.deal_ID
  669. LIMIT 5)
  670. UNION ALL
  671. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  672. deals_locations.location_ID, deals.hits
  673. FROM deals
  674. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  675. AND deals_locations.location_ID = '16'
  676. WHERE deals.STATUS = 'active'
  677. AND deals_locations.deal_ID = deals.deal_ID
  678. GROUP BY deals.deal_ID
  679. LIMIT 5)
  680. UNION ALL
  681. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  682. deals_locations.location_ID, deals.hits
  683. FROM deals
  684. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  685. AND deals_locations.location_ID = '17'
  686. WHERE deals.STATUS = 'active'
  687. AND deals_locations.deal_ID = deals.deal_ID
  688. GROUP BY deals.deal_ID
  689. LIMIT 5)
  690. UNION ALL
  691. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  692. deals_locations.location_ID, deals.hits
  693. FROM deals
  694. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  695. AND deals_locations.location_ID = '18'
  696. WHERE deals.STATUS = 'active'
  697. AND deals_locations.deal_ID = deals.deal_ID
  698. GROUP BY deals.deal_ID
  699. LIMIT 5)
  700. UNION ALL
  701. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  702. deals_locations.location_ID, deals.hits
  703. FROM deals
  704. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  705. AND deals_locations.location_ID = '19'
  706. WHERE deals.STATUS = 'active'
  707. AND deals_locations.deal_ID = deals.deal_ID
  708. GROUP BY deals.deal_ID
  709. LIMIT 5)
  710. UNION ALL
  711. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  712. deals_locations.location_ID, deals.hits
  713. FROM deals
  714. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  715. AND deals_locations.location_ID = '20'
  716. WHERE deals.STATUS = 'active'
  717. AND deals_locations.deal_ID = deals.deal_ID
  718. GROUP BY deals.deal_ID
  719. LIMIT 5)
  720. UNION ALL
  721. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  722. deals_locations.location_ID, deals.hits
  723. FROM deals
  724. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  725. AND deals_locations.location_ID = '22'
  726. WHERE deals.STATUS = 'active'
  727. AND deals_locations.deal_ID = deals.deal_ID
  728. GROUP BY deals.deal_ID
  729. LIMIT 5)
  730. UNION ALL
  731. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  732. deals_locations.location_ID, deals.hits
  733. FROM deals
  734. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  735. AND deals_locations.location_ID = '23'
  736. WHERE deals.STATUS = 'active'
  737. AND deals_locations.deal_ID = deals.deal_ID
  738. GROUP BY deals.deal_ID
  739. LIMIT 5)
  740. UNION ALL
  741. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  742. deals_locations.location_ID, deals.hits
  743. FROM deals
  744. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  745. AND deals_locations.location_ID = '24'
  746. WHERE deals.STATUS = 'active'
  747. AND deals_locations.deal_ID = deals.deal_ID
  748. GROUP BY deals.deal_ID
  749. LIMIT 5)
  750. UNION ALL
  751. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  752. deals_locations.location_ID, deals.hits
  753. FROM deals
  754. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  755. AND deals_locations.location_ID = '25'
  756. WHERE deals.STATUS = 'active'
  757. AND deals_locations.deal_ID = deals.deal_ID
  758. GROUP BY deals.deal_ID
  759. LIMIT 5)
  760. UNION ALL
  761. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  762. deals_locations.location_ID, deals.hits
  763. FROM deals
  764. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  765. AND deals_locations.location_ID = '45'
  766. WHERE deals.STATUS = 'active'
  767. AND deals_locations.deal_ID = deals.deal_ID
  768. GROUP BY deals.deal_ID
  769. LIMIT 5)
  770. UNION ALL
  771. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  772. deals_locations.location_ID, deals.hits
  773. FROM deals
  774. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  775. AND deals_locations.location_ID = '47'
  776. WHERE deals.STATUS = 'active'
  777. AND deals_locations.deal_ID = deals.deal_ID
  778. GROUP BY deals.deal_ID
  779. LIMIT 5)
  780. UNION ALL
  781. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  782. deals_locations.location_ID, deals.hits
  783. FROM deals
  784. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  785. AND deals_locations.location_ID = '48'
  786. WHERE deals.STATUS = 'active'
  787. AND deals_locations.deal_ID = deals.deal_ID
  788. GROUP BY deals.deal_ID
  789. LIMIT 5)
  790. UNION ALL
  791. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  792. deals_locations.location_ID, deals.hits
  793. FROM deals
  794. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  795. AND deals_locations.location_ID = '50'
  796. WHERE deals.STATUS = 'active'
  797. AND deals_locations.deal_ID = deals.deal_ID
  798. GROUP BY deals.deal_ID
  799. LIMIT 5)
  800. UNION ALL
  801. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  802. deals_locations.location_ID, deals.hits
  803. FROM deals
  804. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  805. AND deals_locations.location_ID = '57'
  806. WHERE deals.STATUS = 'active'
  807. AND deals_locations.deal_ID = deals.deal_ID
  808. GROUP BY deals.deal_ID
  809. LIMIT 5)
  810. UNION ALL
  811. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  812. deals_locations.location_ID, deals.hits
  813. FROM deals
  814. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  815. AND deals_locations.location_ID = '58'
  816. WHERE deals.STATUS = 'active'
  817. AND deals_locations.deal_ID = deals.deal_ID
  818. GROUP BY deals.deal_ID
  819. LIMIT 5)
  820. UNION ALL
  821. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  822. deals_locations.location_ID, deals.hits
  823. FROM deals
  824. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  825. AND deals_locations.location_ID = '59'
  826. WHERE deals.STATUS = 'active'
  827. AND deals_locations.deal_ID = deals.deal_ID
  828. GROUP BY deals.deal_ID
  829. LIMIT 5)
  830. UNION ALL
  831. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  832. deals_locations.location_ID, deals.hits
  833. FROM deals
  834. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  835. AND deals_locations.location_ID = '61'
  836. WHERE deals.STATUS = 'active'
  837. AND deals_locations.deal_ID = deals.deal_ID
  838. GROUP BY deals.deal_ID
  839. LIMIT 5)
  840. UNION ALL
  841. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  842. deals_locations.location_ID, deals.hits
  843. FROM deals
  844. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  845. AND deals_locations.location_ID = '63'
  846. WHERE deals.STATUS = 'active'
  847. AND deals_locations.deal_ID = deals.deal_ID
  848. GROUP BY deals.deal_ID
  849. LIMIT 5)
  850. UNION ALL
  851. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  852. deals_locations.location_ID, deals.hits
  853. FROM deals
  854. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  855. AND deals_locations.location_ID = '71'
  856. WHERE deals.STATUS = 'active'
  857. AND deals_locations.deal_ID = deals.deal_ID
  858. GROUP BY deals.deal_ID
  859. LIMIT 5)
  860. UNION ALL
  861. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  862. deals_locations.location_ID, deals.hits
  863. FROM deals
  864. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  865. AND deals_locations.location_ID = '73'
  866. WHERE deals.STATUS = 'active'
  867. AND deals_locations.deal_ID = deals.deal_ID
  868. GROUP BY deals.deal_ID
  869. LIMIT 5)
  870. UNION ALL
  871. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  872. deals_locations.location_ID, deals.hits
  873. FROM deals
  874. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  875. AND deals_locations.location_ID = '84'
  876. WHERE deals.STATUS = 'active'
  877. AND deals_locations.deal_ID = deals.deal_ID
  878. GROUP BY deals.deal_ID
  879. LIMIT 5)
  880. UNION ALL
  881. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  882. deals_locations.location_ID, deals.hits
  883. FROM deals
  884. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  885. AND deals_locations.location_ID = '85'
  886. WHERE deals.STATUS = 'active'
  887. AND deals_locations.deal_ID = deals.deal_ID
  888. GROUP BY deals.deal_ID
  889. LIMIT 5)
  890. UNION ALL
  891. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  892. deals_locations.location_ID, deals.hits
  893. FROM deals
  894. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  895. AND deals_locations.location_ID = '86'
  896. WHERE deals.STATUS = 'active'
  897. AND deals_locations.deal_ID = deals.deal_ID
  898. GROUP BY deals.deal_ID
  899. LIMIT 5)
  900. UNION ALL
  901. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  902. deals_locations.location_ID, deals.hits
  903. FROM deals
  904. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  905. AND deals_locations.location_ID = '87'
  906. WHERE deals.STATUS = 'active'
  907. AND deals_locations.deal_ID = deals.deal_ID
  908. GROUP BY deals.deal_ID
  909. LIMIT 5)
  910. UNION ALL
  911. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  912. deals_locations.location_ID, deals.hits
  913. FROM deals
  914. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  915. AND deals_locations.location_ID = '88'
  916. WHERE deals.STATUS = 'active'
  917. AND deals_locations.deal_ID = deals.deal_ID
  918. GROUP BY deals.deal_ID
  919. LIMIT 5)
  920. UNION ALL
  921. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  922. deals_locations.location_ID, deals.hits
  923. FROM deals
  924. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  925. AND deals_locations.location_ID = '91'
  926. WHERE deals.STATUS = 'active'
  927. AND deals_locations.deal_ID = deals.deal_ID
  928. GROUP BY deals.deal_ID
  929. LIMIT 5)
  930. UNION ALL
  931. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  932. deals_locations.location_ID, deals.hits
  933. FROM deals
  934. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  935. AND deals_locations.location_ID = '92'
  936. WHERE deals.STATUS = 'active'
  937. AND deals_locations.deal_ID = deals.deal_ID
  938. GROUP BY deals.deal_ID
  939. LIMIT 5)
  940. UNION ALL
  941. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  942. deals_locations.location_ID, deals.hits
  943. FROM deals
  944. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  945. AND deals_locations.location_ID = '93'
  946. WHERE deals.STATUS = 'active'
  947. AND deals_locations.deal_ID = deals.deal_ID
  948. GROUP BY deals.deal_ID
  949. LIMIT 5)
  950. UNION ALL
  951. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  952. deals_locations.location_ID, deals.hits
  953. FROM deals
  954. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  955. AND deals_locations.location_ID = '94'
  956. WHERE deals.STATUS = 'active'
  957. AND deals_locations.deal_ID = deals.deal_ID
  958. GROUP BY deals.deal_ID
  959. LIMIT 5)
  960. UNION ALL
  961. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  962. deals_locations.location_ID, deals.hits
  963. FROM deals
  964. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  965. AND deals_locations.location_ID = '95'
  966. WHERE deals.STATUS = 'active'
  967. AND deals_locations.deal_ID = deals.deal_ID
  968. GROUP BY deals.deal_ID
  969. LIMIT 5)
  970. UNION ALL
  971. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  972. deals_locations.location_ID, deals.hits
  973. FROM deals
  974. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  975. AND deals_locations.location_ID = '96'
  976. WHERE deals.STATUS = 'active'
  977. AND deals_locations.deal_ID = deals.deal_ID
  978. GROUP BY deals.deal_ID
  979. LIMIT 5)
  980. UNION ALL
  981. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  982. deals_locations.location_ID, deals.hits
  983. FROM deals
  984. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  985. AND deals_locations.location_ID = '98'
  986. WHERE deals.STATUS = 'active'
  987. AND deals_locations.deal_ID = deals.deal_ID
  988. GROUP BY deals.deal_ID
  989. LIMIT 5)
  990. UNION ALL
  991. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  992. deals_locations.location_ID, deals.hits
  993. FROM deals
  994. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  995. AND deals_locations.location_ID = '99'
  996. WHERE deals.STATUS = 'active'
  997. AND deals_locations.deal_ID = deals.deal_ID
  998. GROUP BY deals.deal_ID
  999. LIMIT 5)
  1000. UNION ALL
  1001. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  1002. deals_locations.location_ID, deals.hits
  1003. FROM deals
  1004. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  1005. AND deals_locations.location_ID = '100'
  1006. WHERE deals.STATUS = 'active'
  1007. AND deals_locations.deal_ID = deals.deal_ID
  1008. GROUP BY deals.deal_ID
  1009. LIMIT 5)
  1010. UNION ALL
  1011. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  1012. deals_locations.location_ID, deals.hits
  1013. FROM deals
  1014. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  1015. AND deals_locations.location_ID = '101'
  1016. WHERE deals.STATUS = 'active'
  1017. AND deals_locations.deal_ID = deals.deal_ID
  1018. GROUP BY deals.deal_ID
  1019. LIMIT 5)
  1020. UNION ALL
  1021. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  1022. deals_locations.location_ID, deals.hits
  1023. FROM deals
  1024. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  1025. AND deals_locations.location_ID = '102'
  1026. WHERE deals.STATUS = 'active'
  1027. AND deals_locations.deal_ID = deals.deal_ID
  1028. GROUP BY deals.deal_ID
  1029. LIMIT 5)
  1030. UNION ALL
  1031. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  1032. deals_locations.location_ID, deals.hits
  1033. FROM deals
  1034. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  1035. AND deals_locations.location_ID = '103'
  1036. WHERE deals.STATUS = 'active'
  1037. AND deals_locations.deal_ID = deals.deal_ID
  1038. GROUP BY deals.deal_ID
  1039. LIMIT 5)
  1040. UNION ALL
  1041. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  1042. deals_locations.location_ID, deals.hits
  1043. FROM deals
  1044. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  1045. AND deals_locations.location_ID = '104'
  1046. WHERE deals.STATUS = 'active'
  1047. AND deals_locations.deal_ID = deals.deal_ID
  1048. GROUP BY deals.deal_ID
  1049. LIMIT 5)
  1050. UNION ALL
  1051. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  1052. deals_locations.location_ID, deals.hits
  1053. FROM deals
  1054. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  1055. AND deals_locations.location_ID = '105'
  1056. WHERE deals.STATUS = 'active'
  1057. AND deals_locations.deal_ID = deals.deal_ID
  1058. GROUP BY deals.deal_ID
  1059. LIMIT 5)
  1060. UNION ALL
  1061. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  1062. deals_locations.location_ID, deals.hits
  1063. FROM deals
  1064. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  1065. AND deals_locations.location_ID = '106'
  1066. WHERE deals.STATUS = 'active'
  1067. AND deals_locations.deal_ID = deals.deal_ID
  1068. GROUP BY deals.deal_ID
  1069. LIMIT 5)
  1070. UNION ALL
  1071. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  1072. deals_locations.location_ID, deals.hits
  1073. FROM deals
  1074. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  1075. AND deals_locations.location_ID = '108'
  1076. WHERE deals.STATUS = 'active'
  1077. AND deals_locations.deal_ID = deals.deal_ID
  1078. GROUP BY deals.deal_ID
  1079. LIMIT 5)
  1080. UNION ALL
  1081. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  1082. deals_locations.location_ID, deals.hits
  1083. FROM deals
  1084. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  1085. AND deals_locations.location_ID = '109'
  1086. WHERE deals.STATUS = 'active'
  1087. AND deals_locations.deal_ID = deals.deal_ID
  1088. GROUP BY deals.deal_ID
  1089. LIMIT 5)
  1090. UNION ALL
  1091. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  1092. deals_locations.location_ID, deals.hits
  1093. FROM deals
  1094. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  1095. AND deals_locations.location_ID = '110'
  1096. WHERE deals.STATUS = 'active'
  1097. AND deals_locations.deal_ID = deals.deal_ID
  1098. GROUP BY deals.deal_ID
  1099. LIMIT 5)
  1100. UNION ALL
  1101. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  1102. deals_locations.location_ID, deals.hits
  1103. FROM deals
  1104. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  1105. AND deals_locations.location_ID = '111'
  1106. WHERE deals.STATUS = 'active'
  1107. AND deals_locations.deal_ID = deals.deal_ID
  1108. GROUP BY deals.deal_ID
  1109. LIMIT 5)
  1110. UNION ALL
  1111. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  1112. deals_locations.location_ID, deals.hits
  1113. FROM deals
  1114. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  1115. AND deals_locations.location_ID = '112'
  1116. WHERE deals.STATUS = 'active'
  1117. AND deals_locations.deal_ID = deals.deal_ID
  1118. GROUP BY deals.deal_ID
  1119. LIMIT 5)
  1120. UNION ALL
  1121. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  1122. deals_locations.location_ID, deals.hits
  1123. FROM deals
  1124. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  1125. AND deals_locations.location_ID = '113'
  1126. WHERE deals.STATUS = 'active'
  1127. AND deals_locations.deal_ID = deals.deal_ID
  1128. GROUP BY deals.deal_ID
  1129. LIMIT 5)
  1130. UNION ALL
  1131. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  1132. deals_locations.location_ID, deals.hits
  1133. FROM deals
  1134. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  1135. AND deals_locations.location_ID = '114'
  1136. WHERE deals.STATUS = 'active'
  1137. AND deals_locations.deal_ID = deals.deal_ID
  1138. GROUP BY deals.deal_ID
  1139. LIMIT 5)
  1140. UNION ALL
  1141. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  1142. deals_locations.location_ID, deals.hits
  1143. FROM deals
  1144. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  1145. AND deals_locations.location_ID = '115'
  1146. WHERE deals.STATUS = 'active'
  1147. AND deals_locations.deal_ID = deals.deal_ID
  1148. GROUP BY deals.deal_ID
  1149. LIMIT 5)
  1150. UNION ALL
  1151. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  1152. deals_locations.location_ID, deals.hits
  1153. FROM deals
  1154. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  1155. AND deals_locations.location_ID = '116'
  1156. WHERE deals.STATUS = 'active'
  1157. AND deals_locations.deal_ID = deals.deal_ID
  1158. GROUP BY deals.deal_ID
  1159. LIMIT 5)
  1160. UNION ALL
  1161. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  1162. deals_locations.location_ID, deals.hits
  1163. FROM deals
  1164. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  1165. AND deals_locations.location_ID = '117'
  1166. WHERE deals.STATUS = 'active'
  1167. AND deals_locations.deal_ID = deals.deal_ID
  1168. GROUP BY deals.deal_ID
  1169. LIMIT 5)
  1170. UNION ALL
  1171. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  1172. deals_locations.location_ID, deals.hits
  1173. FROM deals
  1174. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  1175. AND deals_locations.location_ID = '118'
  1176. WHERE deals.STATUS = 'active'
  1177. AND deals_locations.deal_ID = deals.deal_ID
  1178. GROUP BY deals.deal_ID
  1179. LIMIT 5)
  1180. UNION ALL
  1181. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  1182. deals_locations.location_ID, deals.hits
  1183. FROM deals
  1184. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  1185. AND deals_locations.location_ID = '119'
  1186. WHERE deals.STATUS = 'active'
  1187. AND deals_locations.deal_ID = deals.deal_ID
  1188. GROUP BY deals.deal_ID
  1189. LIMIT 5)
  1190. UNION ALL
  1191. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  1192. deals_locations.location_ID, deals.hits
  1193. FROM deals
  1194. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  1195. AND deals_locations.location_ID = '120'
  1196. WHERE deals.STATUS = 'active'
  1197. AND deals_locations.deal_ID = deals.deal_ID
  1198. GROUP BY deals.deal_ID
  1199. LIMIT 5)
  1200. UNION ALL
  1201. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  1202. deals_locations.location_ID, deals.hits
  1203. FROM deals
  1204. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  1205. AND deals_locations.location_ID = '121'
  1206. WHERE deals.STATUS = 'active'
  1207. AND deals_locations.deal_ID = deals.deal_ID
  1208. GROUP BY deals.deal_ID
  1209. LIMIT 5)
  1210. UNION ALL
  1211. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  1212. deals_locations.location_ID, deals.hits
  1213. FROM deals
  1214. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  1215. AND deals_locations.location_ID = '122'
  1216. WHERE deals.STATUS = 'active'
  1217. AND deals_locations.deal_ID = deals.deal_ID
  1218. GROUP BY deals.deal_ID
  1219. LIMIT 5)
  1220. UNION ALL
  1221. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  1222. deals_locations.location_ID, deals.hits
  1223. FROM deals
  1224. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  1225. AND deals_locations.location_ID = '123'
  1226. WHERE deals.STATUS = 'active'
  1227. AND deals_locations.deal_ID = deals.deal_ID
  1228. GROUP BY deals.deal_ID
  1229. LIMIT 5)
  1230. UNION ALL
  1231. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  1232. deals_locations.location_ID, deals.hits
  1233. FROM deals
  1234. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  1235. AND deals_locations.location_ID = '124'
  1236. WHERE deals.STATUS = 'active'
  1237. AND deals_locations.deal_ID = deals.deal_ID
  1238. GROUP BY deals.deal_ID
  1239. LIMIT 5)
  1240. UNION ALL
  1241. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  1242. deals_locations.location_ID, deals.hits
  1243. FROM deals
  1244. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  1245. AND deals_locations.location_ID = '125'
  1246. WHERE deals.STATUS = 'active'
  1247. AND deals_locations.deal_ID = deals.deal_ID
  1248. GROUP BY deals.deal_ID
  1249. LIMIT 5)
  1250. UNION ALL
  1251. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  1252. deals_locations.location_ID, deals.hits
  1253. FROM deals
  1254. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  1255. AND deals_locations.location_ID = '126'
  1256. WHERE deals.STATUS = 'active'
  1257. AND deals_locations.deal_ID = deals.deal_ID
  1258. GROUP BY deals.deal_ID
  1259. LIMIT 5)
  1260. UNION ALL
  1261. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  1262. deals_locations.location_ID, deals.hits
  1263. FROM deals
  1264. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  1265. AND deals_locations.location_ID = '127'
  1266. WHERE deals.STATUS = 'active'
  1267. AND deals_locations.deal_ID = deals.deal_ID
  1268. GROUP BY deals.deal_ID
  1269. LIMIT 5)
  1270. UNION ALL
  1271. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  1272. deals_locations.location_ID, deals.hits
  1273. FROM deals
  1274. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  1275. AND deals_locations.location_ID = '128'
  1276. WHERE deals.STATUS = 'active'
  1277. AND deals_locations.deal_ID = deals.deal_ID
  1278. GROUP BY deals.deal_ID
  1279. LIMIT 5)
  1280. UNION ALL
  1281. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  1282. deals_locations.location_ID, deals.hits
  1283. FROM deals
  1284. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  1285. AND deals_locations.location_ID = '129'
  1286. WHERE deals.STATUS = 'active'
  1287. AND deals_locations.deal_ID = deals.deal_ID
  1288. GROUP BY deals.deal_ID
  1289. LIMIT 5)
  1290. UNION ALL
  1291. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  1292. deals_locations.location_ID, deals.hits
  1293. FROM deals
  1294. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  1295. AND deals_locations.location_ID = '130'
  1296. WHERE deals.STATUS = 'active'
  1297. AND deals_locations.deal_ID = deals.deal_ID
  1298. GROUP BY deals.deal_ID
  1299. LIMIT 5)
  1300. UNION ALL
  1301. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  1302. deals_locations.location_ID, deals.hits
  1303. FROM deals
  1304. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  1305. AND deals_locations.location_ID = '131'
  1306. WHERE deals.STATUS = 'active'
  1307. AND deals_locations.deal_ID = deals.deal_ID
  1308. GROUP BY deals.deal_ID
  1309. LIMIT 5)
  1310. UNION ALL
  1311. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  1312. deals_locations.location_ID, deals.hits
  1313. FROM deals
  1314. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  1315. AND deals_locations.location_ID = '132'
  1316. WHERE deals.STATUS = 'active'
  1317. AND deals_locations.deal_ID = deals.deal_ID
  1318. GROUP BY deals.deal_ID
  1319. LIMIT 5)
  1320. UNION ALL
  1321. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  1322. deals_locations.location_ID, deals.hits
  1323. FROM deals
  1324. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  1325. AND deals_locations.location_ID = '133'
  1326. WHERE deals.STATUS = 'active'
  1327. AND deals_locations.deal_ID = deals.deal_ID
  1328. GROUP BY deals.deal_ID
  1329. LIMIT 5)
  1330. UNION ALL
  1331. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  1332. deals_locations.location_ID, deals.hits
  1333. FROM deals
  1334. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  1335. AND deals_locations.location_ID = '134'
  1336. WHERE deals.STATUS = 'active'
  1337. AND deals_locations.deal_ID = deals.deal_ID
  1338. GROUP BY deals.deal_ID
  1339. LIMIT 5)
  1340. UNION ALL
  1341. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  1342. deals_locations.location_ID, deals.hits
  1343. FROM deals
  1344. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  1345. AND deals_locations.location_ID = '135'
  1346. WHERE deals.STATUS = 'active'
  1347. AND deals_locations.deal_ID = deals.deal_ID
  1348. GROUP BY deals.deal_ID
  1349. LIMIT 5)
  1350. UNION ALL
  1351. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  1352. deals_locations.location_ID, deals.hits
  1353. FROM deals
  1354. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  1355. AND deals_locations.location_ID = '136'
  1356. WHERE deals.STATUS = 'active'
  1357. AND deals_locations.deal_ID = deals.deal_ID
  1358. GROUP BY deals.deal_ID
  1359. LIMIT 5)
  1360. UNION ALL
  1361. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  1362. deals_locations.location_ID, deals.hits
  1363. FROM deals
  1364. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  1365. AND deals_locations.location_ID = '137'
  1366. WHERE deals.STATUS = 'active'
  1367. AND deals_locations.deal_ID = deals.deal_ID
  1368. GROUP BY deals.deal_ID
  1369. LIMIT 5)
  1370. UNION ALL
  1371. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  1372. deals_locations.location_ID, deals.hits
  1373. FROM deals
  1374. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  1375. AND deals_locations.location_ID = '138'
  1376. WHERE deals.STATUS = 'active'
  1377. AND deals_locations.deal_ID = deals.deal_ID
  1378. GROUP BY deals.deal_ID
  1379. LIMIT 5)
  1380. UNION ALL
  1381. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  1382. deals_locations.location_ID, deals.hits
  1383. FROM deals
  1384. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  1385. AND deals_locations.location_ID = '139'
  1386. WHERE deals.STATUS = 'active'
  1387. AND deals_locations.deal_ID = deals.deal_ID
  1388. GROUP BY deals.deal_ID
  1389. LIMIT 5)
  1390. UNION ALL
  1391. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  1392. deals_locations.location_ID, deals.hits
  1393. FROM deals
  1394. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  1395. AND deals_locations.location_ID = '140'
  1396. WHERE deals.STATUS = 'active'
  1397. AND deals_locations.deal_ID = deals.deal_ID
  1398. GROUP BY deals.deal_ID
  1399. LIMIT 5)
  1400. UNION ALL
  1401. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  1402. deals_locations.location_ID, deals.hits
  1403. FROM deals
  1404. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  1405. AND deals_locations.location_ID = '141'
  1406. WHERE deals.STATUS = 'active'
  1407. AND deals_locations.deal_ID = deals.deal_ID
  1408. GROUP BY deals.deal_ID
  1409. LIMIT 5)
  1410. UNION ALL
  1411. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  1412. deals_locations.location_ID, deals.hits
  1413. FROM deals
  1414. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  1415. AND deals_locations.location_ID = '142'
  1416. WHERE deals.STATUS = 'active'
  1417. AND deals_locations.deal_ID = deals.deal_ID
  1418. GROUP BY deals.deal_ID
  1419. LIMIT 5)
  1420. UNION ALL
  1421. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  1422. deals_locations.location_ID, deals.hits
  1423. FROM deals
  1424. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  1425. AND deals_locations.location_ID = '143'
  1426. WHERE deals.STATUS = 'active'
  1427. AND deals_locations.deal_ID = deals.deal_ID
  1428. GROUP BY deals.deal_ID
  1429. LIMIT 5)
  1430. UNION ALL
  1431. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  1432. deals_locations.location_ID, deals.hits
  1433. FROM deals
  1434. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  1435. AND deals_locations.location_ID = '144'
  1436. WHERE deals.STATUS = 'active'
  1437. AND deals_locations.deal_ID = deals.deal_ID
  1438. GROUP BY deals.deal_ID
  1439. LIMIT 5)
  1440. UNION ALL
  1441. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  1442. deals_locations.location_ID, deals.hits
  1443. FROM deals
  1444. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  1445. AND deals_locations.location_ID = '145'
  1446. WHERE deals.STATUS = 'active'
  1447. AND deals_locations.deal_ID = deals.deal_ID
  1448. GROUP BY deals.deal_ID
  1449. LIMIT 5)
  1450. UNION ALL
  1451. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  1452. deals_locations.location_ID, deals.hits
  1453. FROM deals
  1454. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  1455. AND deals_locations.location_ID = '146'
  1456. WHERE deals.STATUS = 'active'
  1457. AND deals_locations.deal_ID = deals.deal_ID
  1458. GROUP BY deals.deal_ID
  1459. LIMIT 5)
  1460. UNION ALL
  1461. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  1462. deals_locations.location_ID, deals.hits
  1463. FROM deals
  1464. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  1465. AND deals_locations.location_ID = '147'
  1466. WHERE deals.STATUS = 'active'
  1467. AND deals_locations.deal_ID = deals.deal_ID
  1468. GROUP BY deals.deal_ID
  1469. LIMIT 5)
  1470. UNION ALL
  1471. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  1472. deals_locations.location_ID, deals.hits
  1473. FROM deals
  1474. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  1475. AND deals_locations.location_ID = '148'
  1476. WHERE deals.STATUS = 'active'
  1477. AND deals_locations.deal_ID = deals.deal_ID
  1478. GROUP BY deals.deal_ID
  1479. LIMIT 5)
  1480. UNION ALL
  1481. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  1482. deals_locations.location_ID, deals.hits
  1483. FROM deals
  1484. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  1485. AND deals_locations.location_ID = '149'
  1486. WHERE deals.STATUS = 'active'
  1487. AND deals_locations.deal_ID = deals.deal_ID
  1488. GROUP BY deals.deal_ID
  1489. LIMIT 5)
  1490. UNION ALL
  1491. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  1492. deals_locations.location_ID, deals.hits
  1493. FROM deals
  1494. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  1495. AND deals_locations.location_ID = '150'
  1496. WHERE deals.STATUS = 'active'
  1497. AND deals_locations.deal_ID = deals.deal_ID
  1498. GROUP BY deals.deal_ID
  1499. LIMIT 5)
  1500. UNION ALL
  1501. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  1502. deals_locations.location_ID, deals.hits
  1503. FROM deals
  1504. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  1505. AND deals_locations.location_ID = '151'
  1506. WHERE deals.STATUS = 'active'
  1507. AND deals_locations.deal_ID = deals.deal_ID
  1508. GROUP BY deals.deal_ID
  1509. LIMIT 5)
  1510. UNION ALL
  1511. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  1512. deals_locations.location_ID, deals.hits
  1513. FROM deals
  1514. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  1515. AND deals_locations.location_ID = '152'
  1516. WHERE deals.STATUS = 'active'
  1517. AND deals_locations.deal_ID = deals.deal_ID
  1518. GROUP BY deals.deal_ID
  1519. LIMIT 5)
  1520. UNION ALL
  1521. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  1522. deals_locations.location_ID, deals.hits
  1523. FROM deals
  1524. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  1525. AND deals_locations.location_ID = '153'
  1526. WHERE deals.STATUS = 'active'
  1527. AND deals_locations.deal_ID = deals.deal_ID
  1528. GROUP BY deals.deal_ID
  1529. LIMIT 5)
  1530. UNION ALL
  1531. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  1532. deals_locations.location_ID, deals.hits
  1533. FROM deals
  1534. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  1535. AND deals_locations.location_ID = '154'
  1536. WHERE deals.STATUS = 'active'
  1537. AND deals_locations.deal_ID = deals.deal_ID
  1538. GROUP BY deals.deal_ID
  1539. LIMIT 5)
  1540. UNION ALL
  1541. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  1542. deals_locations.location_ID, deals.hits
  1543. FROM deals
  1544. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  1545. AND deals_locations.location_ID = '155'
  1546. WHERE deals.STATUS = 'active'
  1547. AND deals_locations.deal_ID = deals.deal_ID
  1548. GROUP BY deals.deal_ID
  1549. LIMIT 5)
  1550. UNION ALL
  1551. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  1552. deals_locations.location_ID, deals.hits
  1553. FROM deals
  1554. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  1555. AND deals_locations.location_ID = '156'
  1556. WHERE deals.STATUS = 'active'
  1557. AND deals_locations.deal_ID = deals.deal_ID
  1558. GROUP BY deals.deal_ID
  1559. LIMIT 5)
  1560. UNION ALL
  1561. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  1562. deals_locations.location_ID, deals.hits
  1563. FROM deals
  1564. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  1565. AND deals_locations.location_ID = '157'
  1566. WHERE deals.STATUS = 'active'
  1567. AND deals_locations.deal_ID = deals.deal_ID
  1568. GROUP BY deals.deal_ID
  1569. LIMIT 5)
  1570. UNION ALL
  1571. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  1572. deals_locations.location_ID, deals.hits
  1573. FROM deals
  1574. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  1575. AND deals_locations.location_ID = '158'
  1576. WHERE deals.STATUS = 'active'
  1577. AND deals_locations.deal_ID = deals.deal_ID
  1578. GROUP BY deals.deal_ID
  1579. LIMIT 5)
  1580. UNION ALL
  1581. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  1582. deals_locations.location_ID, deals.hits
  1583. FROM deals
  1584. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  1585. AND deals_locations.location_ID = '159'
  1586. WHERE deals.STATUS = 'active'
  1587. AND deals_locations.deal_ID = deals.deal_ID
  1588. GROUP BY deals.deal_ID
  1589. LIMIT 5)
  1590. UNION ALL
  1591. (SELECT deals.deal_ID, deals.slug, deals.url, deals.previous_price, deals.title, deals.image, deals.price, deals.END, deals.purchases, deals.date_added,
  1592. deals_locations.location_ID, deals.hits
  1593. FROM deals
  1594. INNER JOIN deals_locations ON deals_locations.deal_ID = deals.deal_ID
  1595. AND deals_locations.location_ID = '160'
  1596. WHERE deals.STATUS = 'active'
  1597. AND deals_locations.deal_ID = deals.deal_ID
  1598. GROUP BY deals.deal_ID
  1599. LIMIT 5)
clone this paste RAW Paste Data