Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # ====================================================
- # Все участники c активными целями в 2.0 +город, КМ, Рег
- # ====================================================
- select
- u.registration_time,
- concat( u.name, ' ', u.surname) 'клиент',
- u.email, u.phone, u.skype,
- concat( r.name, ' ', r.surname) 'Рег',
- concat( k.name, ' ', k.surname) 'КМ',
- c.title
- from users u
- join users_goals g
- on u.id = g.user_id
- and g.is_deleted = 0
- and g.status = 1
- join queues q
- on q.id = g.queue_id
- and q.id = 4
- left join cities c
- on c.id = u.city_id
- left join users k
- on k.id = u.client_manager_id
- left join users r
- on r.id = u.registration_user_id
- group by u.id
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement