Advertisement
vuylov

Untitled

Jul 6th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 1.30 KB | None | 0 0
  1. SELECT `adv_id` as `id`, `adv_img_sqr` as `img_sqr`, `adv_img_hor` as `img_hor`,  
  2.                    `adv_title` as `title`, `adv_desc` as `desc`,  
  3.                    `adv_views` as `all_views`, `adv_clicks` as `all_clicks`,
  4.                    `link_href` as `url`, `adv_link`,
  5. `stat_all`.`teas_clicks` as `all_clicks`, `stat_all`.`teas_views` as `all_views`,
  6.                         `stat_all`.`teas_out` as `all_out`, `stat_all`.`teas_in` as `all_in`,
  7.                     `stat_per`.`teas_clicks` as `per_clicks`, `stat_per`.`teas_views` as `per_views`,
  8.                         `stat_per`.`teas_out` as `per_out`, `stat_per`.`teas_in` as `per_in`
  9.                 FROM `adv_main`
  10.                 LEFT JOIN `news_teas_cache` as `stat_all` ON `stat_all`.`teas_id` = `adv_main`.`adv_id`
  11.                         AND `stat_all`.`teas_period` = 0 AND `stat_all`.`teas_cat` = 0
  12.                 LEFT JOIN `news_teas_cache` as `stat_per` ON `stat_per`.`teas_id` = `adv_main`.`adv_id`
  13.                         AND `stat_per`.`teas_period` = 1 AND `stat_per`.`teas_cat` = 0
  14.                 JOIN `adv_links` ON `adv_links`.`link_id` = `adv_main`.`adv_link`
  15.                 WHERE
  16.                     `adv_status` = '1' AND FIND_IN_SET('RU',`link_target_geo`) > 0 AND `adv_shock` = '0'
  17.                 ORDER BY `adv_id` ASC
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement