Versions Compared

Key

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

When you have multiple subfields for a particular marc field, you can specify that they appear in the same order as they do in the marc record. (Without specifying an order, you will get alphabetical order.) You can do this by using including the "srs_marctab.line" field in your query, and using it in an "order by" statement within a string_agg function.

The example below shows gets the subject headings for a set of instance hrids, contained in 6xx fields. Note that . The subfields are specified (a, x, y and z), and the order of the fields subject headings is specified by an the "order by" statement within the string_agg function. 

When there are multiples of a given marc field (such as the 650 field), you can specify that the subject headings should come from just the FIRST occurrence of that field. Do this by specifying "sm.ord = '1'" in the WHERE criteria in the "lc" subquery.


WITH lc AS 

(SELECTDISTINCT

    sm.instance_hrid,

...

ORDER BY lc.instance_hrid::INTEGER

;


Result example:

Image Added