daily pastebin goal
44%
SHARE
TWEET

Untitled

a guest Dec 11th, 2018 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. SELECT
  2.       DISTINCT `tours_periods_pools_prices`.*
  3.     FROM
  4.          `tours`
  5.     LEFT JOIN
  6.         `tours_periods`
  7.     ON
  8.         `tours_periods`.`tour_id` = `tours`.`id`
  9.     LEFT JOIN
  10.        `tours_periods_transfer_tariffs`
  11.     ON
  12.        `tours_periods_transfer_tariffs`.`period_id` = `tours_periods`.`id` AND `tours_periods_transfer_tariffs`.`tour_day` = 1
  13.     LEFT JOIN
  14.        transfer_tariffs_dates_stops
  15.     ON
  16.         (tours_periods_transfer_tariffs.transfer_tariffs_dates_id = transfer_tariffs_dates_stops.tt_dates_id)
  17.     LEFT JOIN
  18.       `transfer_tariffs_stops`
  19.     ON
  20.       `transfer_tariffs_stops`.`id` = `transfer_tariffs_dates_stops`.`tt_stop_id`
  21.     LEFT JOIN
  22.       `reference_city`
  23.     ON
  24.       `reference_city`.`id` = `transfer_tariffs_stops`.`reference_city_id`
  25.     LEFT JOIN
  26.       `tours_periods_pools`
  27.     ON
  28.       `tours_periods_pools`.`period_id` = `tours_periods`.`id`
  29.     LEFT JOIN
  30.       `tours_periods_pools_prices`
  31.     ON
  32.       `tours_periods_pools_prices`.`pool_id` = `tours_periods_pools`.`id`
  33.     WHERE
  34.       `tours`.`id` = '25'
  35.     AND
  36.        (
  37.         (`tours_periods`.`date_start` = DATE_ADD(str_to_date("2018-12-28","%Y-%m-%d"), INTERVAL -(`transfer_tariffs_dates_stops`.`departure_day`-1) DAY) and `tours_periods`.`full_set` = 0)
  38.             or
  39.         (
  40.                 `tours_periods`.`full_set` = 1
  41.             and
  42.                 `tours_periods`.`date_start` <= DATE_ADD(str_to_date("2018-12-28","%Y-%m-%d"), INTERVAL -(`transfer_tariffs_dates_stops`.`departure_day`-1) DAY)
  43.             and
  44.                 `tours_periods`.`date_to` >= DATE_ADD(str_to_date("2018-12-28","%Y-%m-%d"), INTERVAL -(`transfer_tariffs_dates_stops`.`departure_day`-1) DAY)
  45.             and
  46.                 `tours_periods`.`week_day` LIKE CONCAT ('%', WEEKDAY(DATE_ADD(str_to_date("2018-12-28","%Y-%m-%d"), INTERVAL -(`transfer_tariffs_dates_stops`.`departure_day`-1)+1 DAY)), '%')
  47.         )
  48.        )
  49.      AND `reference_city`.`id` = '465'
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