Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (SELECT core_athlete.id,
- concat_ws(', ', concat_ws(' ', last_name, first_name, middle_name),
- to_char(birth_date, 'DD.MM.YYYY')) as "name",
- 'athlete' as type
- FROM core_athlete WHERE concat_ws(' ', last_name, first_name, middle_name) ILIKE '%%' ORDER BY core_athlete.last_name asc LIMIT 10)
- UNION ALL
- (SELECT core_competition.id,
- concat_ws(', ', name, city, to_char(start_date, 'DD.MM.YYYY')) as name,
- 'competiton' as type
- FROM core_competition WHERE core_competition.name ILIKE '%%' ORDER BY core_competition.name LIMIT 10)
- UNION ALL
- (SELECT webinars_webinar.id, concat_ws(', ', to_char(started_at, 'DD.MM.YYYY HH:MI'), title) as name, 'webinar' as type
- FROM webinars_webinar
- JOIN webinars_webinarattendee on webinars_webinar.id = webinars_webinarattendee.webinar_id where attendee_id = 2 and webinars_webinar.title ILIKE '%%'
- )
- UNION DISTINCT
- (SELECT webinars_webinar.id, concat_ws(', ', to_char(started_at, 'DD.MM.YYYY HH:MI'), title) as name, 'webinar' as type
- FROM webinars_webinar WHERE webinars_webinar.title ILIKE '%%' and private=FALSE)
- ORDER BY type LIMIT 100500;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement