Return format json

select a.f_name, array_to_json(array(select d_name
from hid_department
where d_code_induk=a.f_code AND d_name ILIKE ‘%Cari%’)) as department
from hid_faculty a
where f_code=’xxxxx’ AND f_name ILIKE ‘%Cari%’;

Return format string

select f_name, array_to_string(array(select d_name
from hid_department
where d_code_induk=’xxxxx’),’|’) as department
from hid_faculty
where f_code=’xxxxx’;

Leave a Reply

Your email address will not be published. Required fields are marked *