Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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.

with lc as

(select distinct

        sm.instance_hrid,

        sm.field,

        sm.content


from srs_marctab sm


where sm.instance_hrid between '6403921' and '6404000'

        and sm.field like '6%%'

        and sm.sf in ('a','x','y','z')

        and sm.ind2 = '0'

        and sm.ord = '1'

)


select

        lc.instance_hrid,

        lc.field,

        string_agg (lc.content, ' -- ') as lc_subject


from lc


group by

        lc.instance_hrid,

        lc.field

;