You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Using the chr(10) character in a strigg_agg function will put the aggregated values on separate lines within one cell. This can be useful to make the output more readable on the Excel spreadsheet.

Note: Excel has a cell height maximum of 409 pixels. Some aggregated holdings statements will easily break that limit, so will be truncated on the spreadsheet.


Example: aggregate the instance_contributors so they appear on separate lines in one cell:


SELECT

ii.title,

ii.hrid AS instance_hrid,

STRING_AGG (distinct ic.contributor_name, chr(10)) AS contributors


FROM inventory_instances AS ii

INNER JOIN folio_reporting.instance_contributors AS ic

ON ii.id = ic.instance_id


WHERE ii.title LIKE 'Apples%'

GROUP BY ii.title, ii.hrid


HAVING COUNT (DISTINCT ic.contributor_name) > 1

LIMIT 100

;

  • No labels