Wacky_rubia

Untitled

Nov 27th, 2015
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
T-SQL 0.80 KB | None | 0 0
  1. select flight_number as 'номер рейса', plane_type as 'тип самолета', time_of_departure as 'время вылета',
  2.     arrival_time as 'время прибытия', a.name as 'название компании-перевозчика',
  3.     (select name from towns where id = z.arrival_town_id) as 'город вылета',
  4.     (select name from towns where id = z.departure_town_id) as 'город прибытия'
  5. from flight_info as z join airlines as a on z.company_id = a.id
  6.     where (
  7.     (select count(family_name) from one_flight_info as x join passengers_info as y on x.id=y.one_flight_id
  8.         where z.flight_number=x.flight_id) =
  9.     (select max(u.c) from (select count(family_name) as c from one_flight_info as xx join passengers_info as yy on xx.id=yy.one_flight_id
  10.         group by xx.flight_id) as u))
Advertisement
Add Comment
Please, Sign In to add comment