I have problem. I trying display duplicates from table. My code in pl sql
SELECT intermediary_nr, beneficiary_role, contract_nr
FROM (SELECT *
from (select intermediary_nr,
beneficiary_role,
max(contract_nr) contract_nr
from boscs.atcs_commission_beneficiary
where beneficiary_role = 'LEAD'
and intermediary_nr is not null
group by intermediary_nr, beneficiary_role
ORDER BY dbms_random.value)
union all
SELECT *
from (select intermediary_nr,
beneficiary_role,
max(contract_nr) contract_nr
from boscs.atcs_commission_beneficiary
where beneficiary_role = 'SUP_FOR_LEAD'
and intermediary_nr is not null
group by intermediary_nr, beneficiary_role
ORDER BY dbms_random.value)
union all
SELECT *
from (select intermediary_nr,
beneficiary_role,
max(contract_nr) contract_nr
from boscs.atcs_commission_beneficiary
where beneficiary_role = 'COAGENT'
and intermediary_nr is not null
group by intermediary_nr, beneficiary_role
ORDER BY dbms_random.value))
Select intermediary_nr, beneficiary_role, contract_nt if a.contract_nr = b.contract_nr = c.contract_nr
this relation me interested. I please about tips on how to solve this. Are there any ideas? I want to display only the information that is the same contract_nr for a, b, c. The rest do not. Does anyone know how to complete these questions?