You are on page 1of 1

SELECT

LISTAGG(pq.qualification_outcome , ', ') WITHIN GROUP (ORDER BY


pq.qualification_outcome DESC)
FROM

poq_qualifications pq
WHERE 1=1
and pq.status = 'COMPLETED'
and pq.supplier_id = Supplier.VENDOR_ID
-- and sysdate between pq.effective_start_date and pq.effective_end_date
and to_char(pq.effective_start_date, 'RRRR') = nvl( :p_year ,
to_char(pq.effective_start_date, 'RRRR'))
-- and Party.PARTY_NAME = 'HBL, logistika, d.o.o.'
and pq.qualification_name = ('ZT-TRP')
and pq.effective_start_date = (select max (pq_a.effective_start_date)
from poq_qualifications pq_a

where 1=1
and
pq_a.qualification_name = pq.qualification_name
and pq_a.status =
'COMPLETED'
and
pq_a.supplier_id = pq.supplier_id
and
to_char(pq_a.effective_start_date, 'RRRR') = nvl( :p_year ,
to_char(pq_a.effective_start_date, 'RRRR'))
)

You might also like