Advertisement
Quantos

list o branches

Dec 20th, 2017
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PL/SQL 0.72 KB | None | 0 0
  1. SELECT DISTINCT full_name,
  2.                 listagg(segment2, '; ') within GROUP (ORDER BY segment2) branch_list
  3. FROM (SELECT DISTINCT rt.segment2,
  4.             (SELECT ppv_s.full_name
  5.             FROM per_people_v7 ppv_s
  6.             WHERE ppv_s.person_id = ppv.attribute2) full_name
  7.         FROM hz_cust_site_uses_all hcsua
  8.         left join ra_territories rt ON rt.territory_id = hcsua.territory_id
  9.         INNER JOIN jtf_rs_salesreps jrs ON jrs.salesrep_id = hcsua.primary_salesrep_id
  10.         INNER JOIN jtf_rs_resource_extns_vl jrrev ON jrrev.resource_id = jrs.resource_id
  11.         left join per_people_v7 ppv ON ppv.person_id = jrs.person_id
  12.         WHERE 1=1
  13.         AND ppv.attribute2 IS NOT NULL)
  14. GROUP BY full_name;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement