I have a query as follows:
SELECT string_agg(sn::text, ','), product_id
FROM irmsapp_serializedinventory
group by product_id;
The result is an aggregated sno field and products. I would like to know if we can limit the concatenations to 5 and leave the rest for the sno field. Currently my sno field is a big list and i want to reduce it to a list of 5 elements(the first 5 elements in the sorted order).