Advertisement
bigPingRail

Untitled

May 25th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (SELECT core_athlete.id,
  2.         concat_ws(', ', concat_ws(' ', last_name, first_name, middle_name),
  3.         to_char(birth_date, 'DD.MM.YYYY')) as "name",
  4.         'athlete' as type
  5.   FROM core_athlete WHERE concat_ws(' ', last_name, first_name, middle_name) ILIKE '%%' ORDER BY core_athlete.last_name asc LIMIT 10)
  6.  
  7. UNION ALL
  8.  
  9.   (SELECT core_competition.id,
  10.           concat_ws(', ', name, city, to_char(start_date, 'DD.MM.YYYY')) as name,
  11.           'competiton' as type
  12.   FROM core_competition WHERE core_competition.name ILIKE '%%' ORDER BY core_competition.name LIMIT 10)
  13.  
  14. UNION ALL
  15.  
  16.   (SELECT webinars_webinar.id, concat_ws(', ', to_char(started_at, 'DD.MM.YYYY HH:MI'), title) as name, 'webinar' as type
  17.    FROM webinars_webinar
  18.     JOIN webinars_webinarattendee on webinars_webinar.id = webinars_webinarattendee.webinar_id where attendee_id = 2 and webinars_webinar.title ILIKE '%%'
  19.   )
  20.  
  21.   UNION DISTINCT
  22.  
  23.   (SELECT webinars_webinar.id, concat_ws(', ', to_char(started_at, 'DD.MM.YYYY HH:MI'), title) as name, 'webinar' as type
  24.    FROM webinars_webinar WHERE webinars_webinar.title ILIKE '%%' and private=FALSE)
  25.    ORDER BY type LIMIT 100500;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement