Advertisement
Guest User

Untitled

a guest
Feb 17th, 2020
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 1.85 KB | None | 0 0
  1. select
  2.     t.name as 'Акция',
  3.        t.id as 'Айди родителя',
  4.     tp.name as 'Дочернее название',
  5.        te.id as 'Айди дочернее',
  6.     cw.name as 'Направление',
  7.     if( te.payment='CASH','Наличный','Банк') as 'Оплата',
  8.     (select tpd.included from  tariff_promo_details tpd where tpd.tariff_promo_id=tp.tariff_entry_id and tpd.type='loader') as 'Включено грузчиков',
  9.     (select tpd.additional_price from  tariff_promo_details tpd where tpd.tariff_promo_id=tp.tariff_entry_id and tpd.type='loader') as 'Цена грузчиков',
  10.     (select tpd.additional_price_hour from  tariff_promo_details tpd where tpd.tariff_promo_id=tp.tariff_entry_id and tpd.type='loader') as 'Доп час грузчиков',
  11.     (select tpd.included from  tariff_promo_details tpd where tpd.tariff_promo_id=tp.tariff_entry_id and tpd.type='floor') as 'Включено этажей',
  12.     (select tpd.additional_price from  tariff_promo_details tpd where tpd.tariff_promo_id=tp.tariff_entry_id and tpd.type='floor') as 'Цена этажа',
  13.     te.price as 'Цена',
  14.     te.price_hour as 'Доп час',
  15.     te.price_km as 'цена км',
  16.     te.count_free_km_per_hour as 'Включено км',
  17.     te.price_additional_km as 'Цена доп км',
  18.     t.hint as 'Описание родителя',
  19.     tp.hint as 'Описание дочернее'
  20. from tariff t
  21.          left join city_ways cw on cw.id=t.way_id
  22.          left join city c on c.id=t.city_id
  23.          left join orders_zones oz on oz.id=t.zone_id
  24.          left join tariff_entry te on te.tariff_id=t.id
  25.          left join tariff_promos tp on tp.tariff_entry_id=te.id
  26. where t.type=4 and t.is_delete=0 and is_removed=0 order by Акция,`Дочернее название`,`Включено грузчиков`,Оплата
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement