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. Here is an example using instance HRIDs between 6403921 and 6404000:

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
;


And the results would be: