...
Further, if you want to display the subject heading as it appears in the bibliographic record, you may use a STRING_AGG FUNCTION to format the content rows as a subject heading string. Here is an example using instance HRIDs between 6403921 and 6404000:
with WITH lc as
(select distinctSELECT DISTINCT
sm.instance_hrid,
sm.field,
sm.content
from FROM srs_marctab sm
where WHERE sm.instance_hrid between '6403921' and '6404000'
and AND sm.field like '6%%'
and AND sm.sf in ('a','x','y','z')
and AND sm.ind2 = '0'
and AND sm.ord = '1'
)
selectSELECT
lc.instance_hrid,
...
string_agg (lc.content, ' -- ') as lc_subject
from FROM lc
group byGROUP BY
lc.instance_hrid,
lc.field;
...
;
And
...
the
...
results
...
would
...
be: