Guest User

Untitled

a guest
Jul 2nd, 2020
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. SELECT *,
  2.        --primary_id,  Первого повавшегося значения в данном случае по order by
  3.        json_agg(email) over (PARTITION BY phone) as count_phone,
  4.        count(phone) over (PARTITION BY phone) as count_phone
  5. FROM client
  6.          left join customer c on client.id = c.client_id
  7.          left join "order" o on c.id = o.customer_id
  8. where phone = '123456'
  9. order by o.date_added
Advertisement
Add Comment
Please, Sign In to add comment